結果

問題 No.146 試験監督(1)
ユーザー むらためむらため
提出日時 2019-01-17 04:28:32
言語 Nim
(2.0.2)
結果
AC  
実行時間 13 ms / 1,000 ms
コード長 505 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 66,228 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 22:27:01
合計ジャッジ時間 2,818 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
4,380 KB
testcase_01 AC 13 ms
4,380 KB
testcase_02 AC 13 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

const MOD = 1_0000_0000_7
const HIGH = int32.high
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
proc scan(): int =
  result = 0
  while true:
    var k = getchar_unlocked()
    if k < '0' or k > '9': break
    else: result = 10 * result + k.ord - '0'.ord

let n = scan()
var res = 0
for _ in 0..<n:
  var c = scan()
  var d = scan()
  c = (c+1) shr 1
  if c > HIGH : c = c mod MOD
  if d > HIGH : d = d mod MOD
  res += c * d
  if res > HIGH: res = res mod MOD
echo res
0