結果

問題 No.146 試験監督(1)
コンテスト
ユーザー chiho_miyako
提出日時 2015-04-06 09:44:44
言語 Java
(openjdk 26.0.2.1)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 490 ms / 1,000 ms
+ 30µs
コード長 1,001 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,223 ms
コンパイル使用メモリ 84,224 KB
実行使用メモリ 58,892 KB
最終ジャッジ日時 2026-08-05 22:27:46
合計ジャッジ時間 4,021 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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[] c = new long[n];
       long[] d = new long[n];
       long total = 0;
       long[] t = new long[n];
       for(int i = 0; i<n; i++){
           String c_string = koko.next();
           c[i] = Long.parseLong(c_string);
           String d_string = koko.next();
           d[i] = Long.parseLong(d_string);
           d[i] = d[i]%1000000007;
       
           if(c[i]%2==0){
               c[i] = (c[i]/2)%1000000007;
               t[i] = c[i]*d[i];
               t[i] = t[i]%1000000007;
               total = total + t[i];
           }else{
               c[i] = ((c[i]+1)/2)%1000000007;
               t[i] = c[i]*d[i];
               t[i] = t[i]%1000000007;
               total = total + t[i];
           }
       }
       total = total%1000000007;
       System.out.println(total);
    }
}
0