結果

問題 No.146 試験監督(1)
ユーザー te-shte-sh
提出日時 2016-08-31 00:32:40
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 94 ms / 1,000 ms
コード長 547 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 106,604 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-09-02 21:41:35
合計ジャッジ時間 2,161 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv;
import std.numeric, std.math, std.bigint, std.bitmanip, std.random;
import std.stdio, std.typecons;

const auto mod = 10 ^^ 9 + 7;

void main()
{
  auto n = readln.chomp.to!long;
  auto cdi = iota(n)
    .map!(_ => readln.split.map!(to!long))
    .map!(rd => tuple(rd[0], rd[1]));

  auto r = 0;
  foreach (cd; cdi) {
    auto a = (cd[0] / 2 + (cd[0] % 2 == 0 ? 0 : 1)) % mod;
    auto b = cd[1] % mod;
    r = (r + (a * b) % mod) % mod;
  }

  writeln(r);
}
0