結果
| 問題 | No.72 そろばん Med | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-01-21 13:17:35 | 
| 言語 | Nim (2.2.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 523 bytes | 
| コンパイル時間 | 2,272 ms | 
| コンパイル使用メモリ | 60,732 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-01 10:29:24 | 
| 合計ジャッジ時間 | 3,038 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 24 | 
ソースコード
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) mod 1000007) * ((n-x) mod 1000007)) 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)
            
            
            
        