結果

問題 No.146 試験監督(1)
ユーザー koukonkokoukonko
提出日時 2015-12-12 16:39:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 626 ms / 1,000 ms
コード長 799 bytes
コンパイル時間 2,118 ms
コンパイル使用メモリ 74,928 KB
実行使用メモリ 59,704 KB
最終ジャッジ日時 2023-10-13 11:47:43
合計ジャッジ時間 5,304 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args) {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		try {
			int count = Integer.parseInt(read.readLine());
			BigInteger ans = new BigInteger("0");
			while (count-- > 0) {
				String[] box = read.readLine().split(" ");
				int add = 0;
				if ((Long.parseLong(box[0]) % 2) == 1) {
					add = 1;
				}
				BigInteger fir = new BigInteger("" + ((Long.parseLong(box[0]) / 2) + add));
				ans = ans.add(fir.multiply(new BigInteger(Long.parseLong(box[1]) + "")));
				ans = ans.mod(new BigInteger("1000000007"));
			}

			System.out.println(ans.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
0