Submission #1532133


Source Code Expand

import java.util.Scanner;

/**
 * http://abc026.contest.atcoder.jp/tasks/abc026_d
 */
public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		final int A = sc.nextInt();
		final int B = sc.nextInt();
		final int C = sc.nextInt();
		sc.close();
		
		double minT = (double)(100-B)/(double)A;
		double maxT = (double)(100+B)/(double)A;
		double ans;
		while(true){
			double t = (minT+maxT)/2;
			double f = A*t + B*Math.sin(C*t*Math.PI);
			if(Math.abs(100-f)<0.0000001){
				ans = t;
				break;
			}else if(f<100){
				minT=t;
			}else{
				maxT=t;
			}
			
		}

		System.out.println(ans);
		
	}

}

Submission Info

Submission Time
Task D - 高橋君ボール1号
User namayaki
Language Java8 (OpenJDK 1.8.0)
Score 100
Code Size 684 Byte
Status AC
Exec Time 98 ms
Memory 21844 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 94 ms 21844 KB
example_1.txt AC 98 ms 19156 KB
random_0.txt AC 95 ms 18644 KB
random_1.txt AC 93 ms 20816 KB
random_2.txt AC 94 ms 18640 KB
random_3.txt AC 96 ms 19028 KB
random_4.txt AC 93 ms 19796 KB
random_5.txt AC 95 ms 21588 KB
random_6.txt AC 96 ms 19540 KB
random_7.txt AC 93 ms 18764 KB
random_8.txt AC 94 ms 19924 KB
random_9.txt AC 94 ms 19924 KB
special_0.txt AC 96 ms 20052 KB
special_1.txt AC 98 ms 20820 KB
special_2.txt AC 97 ms 21332 KB