Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
求勒让德符号。。。a^(P-1)/2 %P. JAVA无耻的水过import java.math.*; import java.io.*; import java.util.*; class Main{ public static void main(String args[]){ Scanner cin = new Scanner(System.in); int k =1; BigInteger a,b; int t= cin.nextInt(); BigInteger two = new BigInteger("2"); while(t--!=0){ a = cin.nextBigInteger(); b = cin.nextBigInteger(); System.out.println("Scenario #"+k+":"); k++; if(a.modPow(b.add(BigInteger.ONE.negate()).divide(two), b).compareTo(BigInteger.ONE)==0) System.out.println("1"); else System.out.println("-1"); System.out.println(); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator