Submission #446199


Source Code Expand

Copy
import java.io.*;
import java.util.*;
import java.lang.ArrayIndexOutOfBoundsException;
import java.math.*;

/**
 * @author yoshikyoto
 * 
 * - 答えが int に収まりそうか注意
 * - Sample Input はちゃんと通ることを確認すべし
 */
class Main {
	static Scanner sc = new Scanner(new InputStreamReader(System.in));
	static int a, b, c;
	static double eps = 0.000001;
	public static void main(String[] args) throws Exception {
		a = sc.nextInt();
		b = sc.nextInt();
		c = sc.nextInt();
		
		double center = 100.0 / a;
		double margin = 1.0 / c;
		double left = center - margin;
		double right = center + margin;
		
		while(Math.abs(calc(center) - 100) > eps) {
			center = (left + right) / 2;
			double lv = calc(left);
			double cv = calc(center);
			if((100.0 - lv) * (100.0 - cv) < 0.0) {
				right = center;
			} else {
				left = center;
			}
			center = (left + right) / 2;
		}
		
		System.out.printf("%.16f\n", center);
	}
	
	
	static double calc(double t) {
		return a * t + b * Math.sin(c * t * Math.PI);
	}
}

Submission Info

Submission Time
Task D - 高橋君ボール1号
User yoshikyoto
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 1081 Byte
Status AC
Exec Time 450 ms
Memory 24252 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 17
Set Name Test Cases
Sample example_0.txt, example_1.txt
All example_0.txt, example_1.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, random_5.txt, random_6.txt, random_7.txt, random_8.txt, random_9.txt, special_0.txt, special_1.txt, special_2.txt, example_0.txt, example_1.txt
Case Name Status Exec Time Memory
example_0.txt AC 410 ms 24056 KB
example_1.txt AC 422 ms 24188 KB
random_0.txt AC 425 ms 24184 KB
random_1.txt AC 450 ms 24092 KB
random_2.txt AC 413 ms 24188 KB
random_3.txt AC 412 ms 24160 KB
random_4.txt AC 415 ms 24168 KB
random_5.txt AC 417 ms 24108 KB
random_6.txt AC 415 ms 24252 KB
random_7.txt AC 412 ms 24116 KB
random_8.txt AC 411 ms 24104 KB
random_9.txt AC 411 ms 24152 KB
special_0.txt AC 407 ms 24048 KB
special_1.txt AC 409 ms 24072 KB
special_2.txt AC 408 ms 23984 KB