結果

問題 No.789 範囲の合計
ユーザー keikai_jp
提出日時 2019-02-21 09:11:40
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 1,534 bytes
コンパイル時間 2,087 ms
コンパイル使用メモリ 77,276 KB
実行使用メモリ 39,948 KB
最終ジャッジ日時 2024-11-17 00:12:52
合計ジャッジ時間 4,718 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other RE * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int n = in.nextInt();
			long[] array = new long[1_000_000_000];
			int total = 0;
			for(int i = 0; i < n; i++) {
				array[in.nextInt()] += in.nextInt();
			}
			for(int i = 0; i < array.length; i++) {
				total += array[i];
			}
			out.println(total);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

	}
}
0