标签:style http java os ar new size res
题目链接:CLICK HERE~
有了Java求解大数变得如此简单,以后再也不用担心大数模板了。哦啦啦啦。
import java.math.BigInteger; import java.math.BigDecimal; import java.util.Scanner; class Main{ public static void main(String args[]){ Scanner cin = new Scanner(System.in); while(cin.hasNext()){ int b = cin.nextInt(); BigInteger p,m,res; if(b == 0)break; p = cin.nextBigInteger(b); //以b进制读入,结果自动转换成十进制 m = cin.nextBigInteger(b); res = p.mod(m); String ans = res.toString(b); //将结果转换成b进制的字符串 System.out.println(ans); } } }
标签:style http java os ar new size res
原文地址:http://blog.csdn.net/zhongshijunacm/article/details/38458941