結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
ぴろず
|
| 提出日時 | 2016-11-27 09:18:56 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 689 bytes |
| コンパイル時間 | 2,161 ms |
| コンパイル使用メモリ | 74,512 KB |
| 実行使用メモリ | 51,648 KB |
| 最終ジャッジ日時 | 2024-11-27 12:06:21 |
| 合計ジャッジ時間 | 34,497 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 WA * 3 |
ソースコード
package no443;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
long stime = System.nanoTime();
Scanner sc = new Scanner(System.in);
char[] s = sc.next().toCharArray();
int n = s.length;
BigInteger gcd = new BigInteger(String.valueOf(s));
while((System.nanoTime() - stime) / 1000000 <= 900) {
for(int i=0;i<n-1;i++) {
int j = randInt(i,n-1);
char temp = s[i];
s[i] = s[j];
s[j] = temp;
}
gcd = gcd.gcd(new BigInteger(String.valueOf(s)));
}
System.out.println(gcd);
}
public static int randInt(int min,int max) {
return (int) (Math.random() * (max - min + 1)) + min;
}
}
ぴろず