結果

問題 No.443 GCD of Permutation
ユーザー ぴろずぴろず
提出日時 2016-11-27 09:19:18
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 689 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 71,976 KB
実行使用メモリ 64,796 KB
最終ジャッジ日時 2023-08-18 08:20:30
合計ジャッジ時間 31,329 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 845 ms
60,932 KB
testcase_01 AC 844 ms
59,724 KB
testcase_02 AC 846 ms
59,792 KB
testcase_03 AC 849 ms
60,960 KB
testcase_04 AC 845 ms
60,404 KB
testcase_05 AC 846 ms
57,768 KB
testcase_06 AC 845 ms
57,420 KB
testcase_07 AC 845 ms
60,464 KB
testcase_08 AC 846 ms
60,380 KB
testcase_09 AC 845 ms
60,856 KB
testcase_10 AC 845 ms
59,352 KB
testcase_11 AC 845 ms
60,400 KB
testcase_12 AC 845 ms
60,200 KB
testcase_13 AC 845 ms
59,704 KB
testcase_14 AC 898 ms
62,580 KB
testcase_15 AC 847 ms
62,340 KB
testcase_16 AC 846 ms
62,948 KB
testcase_17 AC 846 ms
62,472 KB
testcase_18 AC 844 ms
62,192 KB
testcase_19 AC 846 ms
64,276 KB
testcase_20 AC 845 ms
62,712 KB
testcase_21 AC 845 ms
62,620 KB
testcase_22 AC 845 ms
61,536 KB
testcase_23 AC 843 ms
61,276 KB
testcase_24 AC 844 ms
61,560 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 845 ms
62,276 KB
testcase_28 WA -
testcase_29 AC 844 ms
62,576 KB
testcase_30 AC 845 ms
62,180 KB
testcase_31 AC 846 ms
62,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 <= 800) {
			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;
	}

}
0