結果

問題 No.146 試験監督(1)
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-06 09:44:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 857 ms / 1,000 ms
コード長 1,001 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 76,192 KB
実行使用メモリ 69,892 KB
最終ジャッジ日時 2023-09-17 06:08:02
合計ジャッジ時間 6,074 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 844 ms
69,892 KB
testcase_01 AC 852 ms
69,568 KB
testcase_02 AC 857 ms
69,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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