結果
問題 |
No.72 そろばん Med
|
ユーザー |
|
提出日時 | 2019-01-21 13:16:05 |
言語 | Nim (2.2.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 2,158 ms |
コンパイル使用メモリ | 61,084 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 10:29:18 |
合計ジャッジ時間 | 3,145 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 RE * 23 |
ソースコード
template `max=`*(x,y) = x = max(x,y) proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let n = scan() let n2 = n div 2 proc f(x:int):int = (x + (x+1) * (n-x)) mod 1000007 let a = n2 * 2 - 1 let b = n let c = 2 * n - 2 * n2 - 1 if a < b and b > c : echo f(n div 2) elif b < a and a > c : echo f(n div 2 - 1) else: echo f(n div 2 + 1)