結果

問題 No.171 スワップ文字列(Med)
ユーザー maimai
提出日時 2016-06-13 19:32:07
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 360 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-04-17 19:07:13
合計ジャッジ時間 2,451 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
12,032 KB
testcase_01 AC 93 ms
12,160 KB
testcase_02 AC 116 ms
12,160 KB
testcase_03 AC 93 ms
12,160 KB
testcase_04 AC 91 ms
11,904 KB
testcase_05 WA -
testcase_06 AC 131 ms
11,904 KB
testcase_07 AC 154 ms
12,032 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 91 ms
12,288 KB
testcase_11 AC 92 ms
12,288 KB
testcase_12 AC 91 ms
12,032 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s=gets.chomp
if s.size==1
    p 0;exit
end

ac={}
s.chars.each{|c|
    ac[c]=0 if !ac[c]
    ac[c]+=1
}

a=(2..s.size).to_a

ac.each{|e|
    (2..e[1]).each{|u|
        a.map!{|e|
            break if u<=1
            g=u.gcd(e)
            if g>1
                e=e/g
                u=u/g
            end
            e
        }
    }
}

p a.inject(:*)%573-1
0