結果

問題 No.146 試験監督(1)
コンテスト
ユーザー nCk_cv
提出日時 2016-01-20 17:42:58
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 893 ms / 1,000 ms
コード長 781 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,314 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 60,044 KB
最終ジャッジ日時 2026-04-09 20:03:07
合計ジャッジ時間 5,896 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.*;
import java.math.*;
import java.io.*;
public class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger bi = new BigInteger("0");
		int n = sc.nextInt();
		BigInteger sum = new BigInteger("0");
		for(int i = 0; i < n; i++) {
			BigInteger c = sc.nextBigInteger();
			BigInteger d = sc.nextBigInteger().mod(new BigInteger("1000000007"));
			BigInteger e = new BigInteger("0");
			e = c.divide(new BigInteger("2")).add(new BigInteger("1"));
			if(c.mod(new BigInteger("2")).equals(new BigInteger("0"))) {
				e = e.subtract(new BigInteger("1"));
			}
			sum = sum.add(e.multiply(d).mod(new BigInteger("1000000007")));
			sum = sum.mod(new BigInteger("1000000007"));
		}
		System.out.println(sum.toString());
		
	}
 }
0