結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 945 ms
60,944 KB
testcase_01 AC 943 ms
60,408 KB
testcase_02 AC 943 ms
60,536 KB
testcase_03 AC 943 ms
61,064 KB
testcase_04 AC 942 ms
61,348 KB
testcase_05 AC 943 ms
59,568 KB
testcase_06 AC 944 ms
59,748 KB
testcase_07 AC 944 ms
60,968 KB
testcase_08 AC 943 ms
60,856 KB
testcase_09 AC 943 ms
61,268 KB
testcase_10 AC 943 ms
59,464 KB
testcase_11 AC 944 ms
60,916 KB
testcase_12 AC 943 ms
60,664 KB
testcase_13 AC 945 ms
59,532 KB
testcase_14 AC 998 ms
64,280 KB
testcase_15 AC 946 ms
62,064 KB
testcase_16 AC 946 ms
63,544 KB
testcase_17 AC 945 ms
62,816 KB
testcase_18 AC 945 ms
62,468 KB
testcase_19 AC 943 ms
62,480 KB
testcase_20 AC 945 ms
62,888 KB
testcase_21 AC 944 ms
62,696 KB
testcase_22 AC 944 ms
61,776 KB
testcase_23 AC 941 ms
61,668 KB
testcase_24 AC 942 ms
61,628 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 944 ms
62,428 KB
testcase_28 WA -
testcase_29 AC 944 ms
62,496 KB
testcase_30 AC 943 ms
62,332 KB
testcase_31 AC 944 ms
63,000 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 <= 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;
	}

}
0