Skip to content

Instantly share code, notes, and snippets.

@menyf
Created December 24, 2016 04:25
Show Gist options
  • Save menyf/9b570b4954529ce32b357373c02de4b9 to your computer and use it in GitHub Desktop.
Save menyf/9b570b4954529ce32b357373c02de4b9 to your computer and use it in GitHub Desktop.
//
// ___FILENAME___
// Created by ___FULLUSERNAME___ on ___DATE___.
import java.math.*;
import java.util.*;
public class Main{
static BigInteger zero = BigInteger.valueOf(0);
static BigInteger one = BigInteger.valueOf(1);
static BigInteger two = BigInteger.valueOf(2);
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
int T_T,cas=1;
T_T = input.nextInt(); //input.hasNext();
<##>
while (T_T-->0) {
BigInteger a = input.nextBigInteger(2); //以二进制方式输入a
BigInteger b = input.nextBigInteger(2);
System.out.println("Case #"+cas+": "+a.gcd(b).toString(2));
cas++;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment