結果

問題 No.146 試験監督(1)
ユーザー uafr_csuafr_cs
提出日時 2015-05-15 13:32:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 319 ms / 1,000 ms
コード長 1,388 bytes
コンパイル時間 2,236 ms
コンパイル使用メモリ 74,840 KB
実行使用メモリ 58,336 KB
最終ジャッジ日時 2023-09-20 08:06:47
合計ジャッジ時間 4,059 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 316 ms
58,336 KB
testcase_01 AC 319 ms
58,280 KB
testcase_02 AC 315 ms
57,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int N = sc.nextInt();
		final long MOD = 1000000007;
		
		long sum = 0;
		for(int i = 0; i < N; i++){
			final long C = sc.nextLong();
			final long D = sc.nextLong() % MOD;
			
			
			sum += (((C + 1) / 2) % MOD) * D;
			sum %= MOD;
		}
		
		System.out.println(sum);
	}
	
	public static class Scanner {
	    private BufferedReader br;
	    private StringTokenizer tok;

	    public Scanner(InputStream is) throws IOException {
	        br = new BufferedReader(new InputStreamReader(is));
	    }

	    private void getLine() throws IOException {
	        while (!hasNext()) { tok = new StringTokenizer(br.readLine()); }
	    }

	    private boolean hasNext() {
	        return tok != null && tok.hasMoreTokens();
	    }

	    public String next() throws IOException {
	        getLine(); return tok.nextToken();
	    }

	    public int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }
	    
	    public long nextLong() throws IOException {
	    	return Long.parseLong(next());
	    }
	    
	    public void close() throws IOException {
	        br.close();
	    }
	}
}
0