結果

問題 No.146 試験監督(1)
ユーザー kenkooookenkoooo
提出日時 2015-04-06 09:24:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 879 ms / 1,000 ms
コード長 643 bytes
コンパイル時間 1,981 ms
コンパイル使用メモリ 71,100 KB
実行使用メモリ 65,232 KB
最終ジャッジ日時 2023-09-17 06:07:12
合計ジャッジ時間 5,888 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 854 ms
64,248 KB
testcase_01 AC 835 ms
65,232 KB
testcase_02 AC 879 ms
65,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner koko = new Scanner(System.in);
		int n = koko.nextInt();

		long total = 0;
		for (int i = 0; i < n; i++) {
			long c = koko.nextLong();
			long d = koko.nextLong();
			d = d % 1000000007;

			if (c % 2 == 0) {
				long e = c / 2;
				e = e % 1000000007;
				long t = e * d;
				t = t % 1000000007;
				total = total + t;
			} else {
				long e = (c + 1) / 2;
				e = e % 1000000007;
				long t = e * d;

				t = t % 1000000007;
				total = total + t;
			}

			total = total % 1000000007;
		}
		System.out.println(total);
	}
}
0