結果
問題 |
No.443 GCD of Permutation
|
ユーザー |
![]() |
提出日時 | 2016-11-11 23:05:15 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 434 bytes |
コンパイル時間 | 123 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-11-25 09:17:42 |
合計ジャッジ時間 | 3,644 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 18 WA * 10 |
コンパイルメッセージ
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 g%2==0 b=g if b>g && 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 cc=1 loop do if c%3==0 c/=3 cc*=3 else break end end j=j ? 5:1 if n!=-1 puts s elsif nn!=-1 puts nn*cc else puts b*cc*j end