結果

問題 No.881 sin(x)/xの和
ユーザー 37zigen
提出日時 2019-09-01 13:11:48
言語 Java
(openjdk 23)
結果
AC  
実行時間 368 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 75,988 KB
実行使用メモリ 61,244 KB
最終ジャッジ日時 2024-11-21 08:01:26
合計ジャッジ時間 10,100 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		if (!(1 <= n && n <= 1000))
			throw new AssertionError();
		double sum = 0;
		for (int i = 0; i < n; ++i) {
			double x = sc.nextDouble();
			double a = sc.nextDouble();
			if (!(Math.abs(a) <= 1 && 0 <= x && x <= 2 * Math.PI))
				throw new AssertionError();
			sum += a;
		}
		System.out.println(sum * Math.PI);
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0