题目大意:关于大数的mod和进制转换,直接使用Java的BigInteger类,正在copy式学习中...

 import java.io.*;
import java.util.*;
import java.math.*; class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
while (true)
{
int base = sc.nextInt();
if (base == 0) break;
String p_str = sc.next();
BigInteger p = new BigInteger(p_str, base);
String m_str = sc.next();
BigInteger m = new BigInteger(m_str, base);
System.out.println((p.mod(m)).toString(base));
}
}
}

UVa 10551 - Basic Remains的更多相关文章

  1. POJ 2305:Basic remains 进制转换

    Basic remains Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5221   Accepted: 2203 Des ...

  2. Basic remains java入门题

    Basic remains input:   b p m    读入p进制的p,m,   求p%m   ,以b进制输出 1 import java.util.*; 2 import java.math ...

  3. 【数论】UVa 10586 - Polynomial Remains

    Problem F: Polynomial Remains Given the polynomial a(x) = an xn + ... + a1 x + a0, compute the remai ...

  4. POJ 1903 & ZOJ 2469 & UVA 1326 Jurassic Remains (部分枚举)

    题意:给定n个只有大写字母组成的字符串,选取尽可能多的字符串,使得这些字符串中每个字母的个数都是偶数.n<=24 思路:直接枚举每个字符串的选或不选,复杂度是O(2^n).其实还有更简便的方法. ...

  5. POJ 2305 Basic remains(进制转换)

    题目链接:http://poj.org/problem?id=2305 ime Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5326 ...

  6. [UVa 1326]Jurassic Remains

    题解 在一个字符串中,每个字符出现的次数本身是无关紧要的,重要的只是这些次数的奇偶性,因此想到用一个二进制的位表示一个字母($1$表示出现奇数次,$0$表示出现偶数次).比如样例的$6$个数,写成二进 ...

  7. Basic remains POJ - 2305 同余模 高精度处理

    题意 给出B(10以内大于0)进制下 p (1000位以内)和m(9位以内) 求 p%m 在b进制下等于什么 思路: 可以计算   1e9不会溢出Int所以m在int值以内  先求m  要处理p  每 ...

  8. UVa 1326 - Jurassic Remains(枚举子集+中途相遇法)

    训练指南p.59 #include <cstdio> #include <cstring> #include <cstdlib> #include <map& ...

  9. [Hanani]JAVA大数相关学习记录

    1.Basic remains 题目链接 涉及内容: |大数读入|大数模|大数进制读入时转化为十进制|大数输出时转化为其他进制输出| import java.io.*; import java.mat ...

随机推荐

  1. hdu_5718_Oracle(大数模拟)

    题目连接:hdu_5718_Oracle 题意: 给你一串数,让你分出两个正整数,使其和最大,若不能分出来就输出"Uncertain" 题解: 当时比赛的时候还天真的去搞大数模版, ...

  2. shell执行php文件传递参数

    php -f index.php hello test 2314 shell命令执行php文件不像http那样通过GET方式传参 同样php文件获取的时候也不能用$_GET方法了 而是通过$argv[ ...

  3. CF 299 div2 C 博弈

    http://codeforces.com/contest/299/problem/C 题目大意: 给两个0,1串保证长度都是2*n(偶数),问,Yaroslav, Andrey按照顺序取,首先是ya ...

  4. Hibernate中用纯SQL查询,并通过hibernate分页返回List<对象>

    @SuppressWarnings("unchecked") public List<Article> getPageQueryList(final int pageN ...

  5. 内联元素的特点SPAN

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. 网络通信TCP编程实例代码

    Makefile: all: gcc -o server server.c -lpthread gcc -o client client.c clean: rm server client serve ...

  7. C#对象序列化笔记

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.R ...

  8. PAT (Advanced Level) 1053. Path of Equal Weight (30)

    简单DFS #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  9. 设计模式笔记之三:Android DataBinding库(MVVM设计模式)

    本博客转自郭霖公众号:http://mp.weixin.qq.com/s?__biz=MzA5MzI3NjE2MA==&mid=2650236908&idx=1&sn=9e53 ...

  10. 神经网络joone_engin模式识别示范,eclipse

    链接: http://pan.baidu.com/s/1kVRducv 密码: junw