結果

問題 No.146 試験監督(1)
ユーザー tsunabittsunabit
提出日時 2019-05-12 14:32:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 865 ms / 1,000 ms
コード長 649 bytes
コンパイル時間 3,183 ms
コンパイル使用メモリ 71,572 KB
実行使用メモリ 65,568 KB
最終ジャッジ日時 2023-09-17 06:05:28
合計ジャッジ時間 7,263 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 865 ms
65,364 KB
testcase_01 AC 828 ms
64,836 KB
testcase_02 AC 842 ms
65,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class No146 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long count = 0;
        long m=1000000007;
        for(int i = 0; i < n; i++) {
        	long c = sc.nextLong();
        	long d = sc.nextLong();
        	if(c % 2 == 0) {
        		count += (c/2)%m * (d%m);
        	}else {
        		count += (c/2 + 1)%m * (d%m);
        	}
        	count = count % m;
        }
        System.out.println(count);
    }
}
0