結果
問題 |
No.3115 One Power One Kill
|
ユーザー |
|
提出日時 | 2025-04-19 15:56:45 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,522 bytes |
コンパイル時間 | 3,036 ms |
コンパイル使用メモリ | 89,628 KB |
実行使用メモリ | 75,928 KB |
平均クエリ数 | 2.00 |
最終ジャッジ日時 | 2025-04-19 15:56:55 |
合計ジャッジ時間 | 8,479 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 11 |
ソースコード
import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main implements Runnable { public static void main(String[] args) { new Thread(null, new Main(), "", 512 * 1024 * 1024).start(); } long powmod(long a, long n, long mod) { if(n==0) return 1; return powmod(a*a%mod,n/2,mod)*(n%2==1?a:1)%mod; } long gcd(long a,long b) { if(a==0)return b; return gcd(b%a,a); } boolean[] isPrime=new boolean[100000]; int[] phi=new int[100000]; int[] f=new int[100000]; { Arrays.setAll(phi, i->i); Arrays.fill(isPrime, true); isPrime[0]=isPrime[1]=false; Arrays.fill(f, 1); for(int i=2;i<isPrime.length;++i) { if(isPrime[i]) { for(int j=2*i;j<isPrime.length;j+=i) { isPrime[j]=false; } for(int j=i;j<isPrime.length;j+=i) { phi[j]-=phi[j]/i; f[j]*=i; } } } } public void run() { long mod=(long)1e9+7; Scanner sc=new Scanner(System.in); // for(int B=100;B<=100000;++B) { // int A=phi[B]; // long Y=powmod(A,B,mod); // if(Y%f[B]!=0)continue; // tr(A,B); // } int A=102; int B=206; System.out.println(A+" "+B); int K=sc.nextInt(); if(K%f[B]==0) { System.out.println(0); } else { System.out.println(1); } } void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));} }