結果
| 問題 | No.537 ユーザーID |
| コンテスト | |
| ユーザー |
object1234
|
| 提出日時 | 2019-01-19 21:25:00 |
| 言語 | Ruby (3.4.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 587 bytes |
| 記録 | |
| コンパイル時間 | 36 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 19,360 KB |
| 最終ジャッジ日時 | 2024-07-18 09:08:35 |
| 合計ジャッジ時間 | 5,215 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 1 -- * 16 |
コンパイルメッセージ
Syntax OK
ソースコード
def yakusu(n)
res = []
(1..n).each do |i|
res << i if n % i == 0
end
res
end
def build_kakezan(yakusu)
max = yakusu.length / 2
i = 0
j = yakusu.length - 1
res = []
until i == max
res << [yakusu[i],yakusu[j]]
i += 1
j -= 1
end
res << [yakusu[max],yakusu[max]] if yakusu.length % 2 != 0
res
end
n = gets.chomp.to_i
res = []
build_kakezan(yakusu(n)).each do |k|
s1 = "#{k[0]}#{k[1]}"
s2 = "#{k[1]}#{k[0]}"
res << s1 if not res.include?(s1)
res << s2 if not res.include?(s2)
end
puts res.length
object1234