結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
4,380 KB
testcase_01 AC 13 ms
4,376 KB
testcase_02 AC 13 ms
4,380 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 =
  while true:
    var k = getchar_unlocked()
    if k < '0' or k > '9': break
    else: result = 10 * result + k.ord - '0'.ord

proc scanf(formatstr: cstring){.header: "<stdio.h>", varargs.}
var n:int
scanf("%ld\n",addr n)
var res = 0
for _ in 0..<n:
  var c = scan()
  var d = scan()
  # scanf("%lld %lld\n",addr c,addr d)
  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