結果

問題 No.146 試験監督(1)
ユーザー mitsuomitsuo
提出日時 2016-05-04 22:18:55
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 809 bytes
コンパイル時間 2,361 ms
コンパイル使用メモリ 77,520 KB
実行使用メモリ 70,324 KB
最終ジャッジ日時 2024-04-15 11:28:29
合計ジャッジ時間 5,744 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] input = new String[sc.nextInt()];
		sc.reset();
		int i = 0;
		while (sc.hasNext()) {
			input[i] = sc.nextLine();
			i++;
		}

		System.out.println(solve(input));

		sc.close();
	}

	public static int solve(String[] in) {
		int N = Integer.valueOf(in[0]);
		int[][] cc = new int[N][];
		for (int i = 1; i < N + 1; i++) {
			cc[i - 1] = new int[2];
			cc[i - 1][0] = Integer.valueOf(in[i].split(" ")[0]);
			cc[i - 1][1] = Integer.valueOf(in[i].split(" ")[1]);
		}

		int total = 0;
		for (int i = 0; i < N; i++) {
			if (cc[i][0] % 2 == 0) {
				total += (cc[i][0] / 2) * cc[i][1];
			} else {
				total += (cc[i][0] + 1) / 2 * cc[i][1];
			}
		}
		return total;
	}
}
0