結果
問題 | No.443 GCD of Permutation |
ユーザー | koyumeishi |
提出日時 | 2016-11-11 23:40:10 |
言語 | Ruby (3.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 852 bytes |
コンパイル時間 | 55 ms |
コンパイル使用メモリ | 11,544 KB |
実行使用メモリ | 46,872 KB |
最終ジャッジ日時 | 2023-08-16 19:53:09 |
合計ジャッジ時間 | 18,999 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 680 ms
15,432 KB |
testcase_01 | AC | 679 ms
15,244 KB |
testcase_02 | AC | 679 ms
15,136 KB |
testcase_03 | AC | 680 ms
15,404 KB |
testcase_04 | AC | 78 ms
15,152 KB |
testcase_05 | AC | 78 ms
15,248 KB |
testcase_06 | AC | 679 ms
15,464 KB |
testcase_07 | AC | 679 ms
15,140 KB |
testcase_08 | AC | 679 ms
15,404 KB |
testcase_09 | AC | 679 ms
15,312 KB |
testcase_10 | AC | 78 ms
15,344 KB |
testcase_11 | AC | 680 ms
15,392 KB |
testcase_12 | AC | 677 ms
15,200 KB |
testcase_13 | AC | 81 ms
15,232 KB |
testcase_14 | AC | 700 ms
23,776 KB |
testcase_15 | AC | 682 ms
21,024 KB |
testcase_16 | AC | 132 ms
17,120 KB |
testcase_17 | AC | 683 ms
17,884 KB |
testcase_18 | RE | - |
testcase_19 | AC | 93 ms
17,476 KB |
testcase_20 | RE | - |
testcase_21 | AC | 681 ms
20,264 KB |
testcase_22 | AC | 680 ms
15,460 KB |
testcase_23 | AC | 678 ms
15,408 KB |
testcase_24 | AC | 680 ms
15,208 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 682 ms
19,528 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 694 ms
24,304 KB |
testcase_31 | RE | - |
コンパイルメッセージ
Main.rb:29: warning: assigned but unused variable - i Main.rb:30: warning: assigned but unused variable - j Syntax OK
ソースコード
#sorry def main s = gets.chomp x = Time.now() def gcd(a,b) if b!=0 then return gcd(b, a%b) else return a end end len = s.length if len == 1 then puts s return end g = s.to_i n = g while true y = Time.now() if y-x > 0.600 then break end for i in 0..10 do for j in 0...5 do a = rand(0...len) b = rand(0...len) u = (n/(10**a))%10 v = (n/(10**b))%10 n = n + (v-u)*(10**a) + (u-v)*(10**b) end g = gcd(g, n) end for i in 0..10 do for j in 0...4 do a = rand(0...len) b = rand(0...len) u = (n/(10**a))%10 v = (n/(10**b))%10 n = n + (v-u)*(10**a) + (u-v)*(10**b) end g = gcd(g, n) end if g == 1 then break end end puts g end main()