标签:des style color io os ar java for sp
3 10 100 100 110 10010 1100
Case #1: 10 Case #2: 10 Case #3: 110
题意:求二进制的最大的正方形
思路:java大数函数都有
import java.math.BigInteger; import java.util.Scanner; /** * Created by acer on 14-9-27. */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t; String a; String b; BigInteger c; BigInteger A; BigInteger B; t = sc.nextInt(); for (int cas = 1; cas <= t; cas++) { A = sc.nextBigInteger(2); B = sc.nextBigInteger(2); System.out.print("Case #" + cas + ": "); System.out.println(A.gcd(B).toString(2)); } } }
标签:des style color io os ar java for sp
原文地址:http://blog.csdn.net/u011345136/article/details/39620429