結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-03-30 22:33:17 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 501 bytes |
| コンパイル時間 | 3,250 ms |
| コンパイル使用メモリ | 65,744 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-30 05:42:46 |
| 合計ジャッジ時間 | 3,962 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 34) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import sequtils, strutils, math, algorithm
var
n = readLine(stdin).parseInt
a:seq[int] = readLine(stdin).split.map(parseInt)
a_dedup:seq[int]
a_dedup = a.deduplicate()
# num of tsuru
proc main():int =
if len(a_dedup) == 1:
if a[0] div (n - 1) == 2:
return n
else:
return 0
else:
var total = max(a_dedup) + 2
for i in 1..n:
if total == i * 2 + (n - i) * 4:
return i
echo main(), " ", n - main()