結果
| 問題 |
No.443 GCD of Permutation
|
| コンテスト | |
| ユーザー |
miraxial
|
| 提出日時 | 2016-11-11 23:33:23 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 519 bytes |
| コンパイル時間 | 44 ms |
| コンパイル使用メモリ | 7,296 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-11-25 09:37:52 |
| 合計ジャッジ時間 | 3,509 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 RE * 2 |
| other | AC * 14 WA * 8 RE * 6 |
コンパイルメッセージ
Syntax OK
ソースコード
s=gets.chomp
c=0
n=s[0].to_i
b=8
j=true
nn=s[0].to_i
s.length.times do |i|
g=s[i].to_i
if b!=1 && g%2==0
b=(b.gcd g) if g!=0
else
b=1
end
if j && g%5==0
j=true
else
j=false
end
if n!=-1 && n!=g
n=-1
end
if nn!=-1 && g!=0 && n!=g
nn=-1
end
c+=g
end
if c%9==0
c=9
elsif c%3==0
c=3
else
c=1
end
j=j ? 5:1
if n!=-1
puts s
elsif nn!=-1
if nn==3 && nn==6
puts nn*c/3
elsif nn==9
puts nn*c/9
else
puts nn
end
else
puts b*c*j
end
if b%2==0
raise
end
miraxial