結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2016-11-11 23:52:57 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 581 bytes |
| コンパイル時間 | 101 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 23,680 KB |
| 最終ジャッジ日時 | 2024-11-25 09:58:32 |
| 合計ジャッジ時間 | 9,003 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 WA * 8 |
コンパイルメッセージ
Main.rb:24: warning: assigned but unused variable - i Main.rb:25: warning: assigned but unused variable - j Syntax OK
ソースコード
#sorry
def main
s = gets.chomp
x = Time.now()
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.200 then
break
end
if g == 1 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+1)) / (10**a))
v = (n % (10**(b+1)) / (10**b))
n = n + ((v-u)*(10**a)) + ((u-v)*(10**b))
end
if g != n then
g = g.gcd(n)
end
end
end
puts g
end
main()
koyumeishi