QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#97608#5610. It's About TimeNicolas125841AC ✓114ms54768kbJava111.2kb2023-04-17 13:28:142023-04-17 13:28:17

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-17 13:28:17]
  • 评测
  • 测评结果:AC
  • 用时:114ms
  • 内存:54768kb
  • [2023-04-17 13:28:14]
  • 提交

answer

import java.io.*;
import java.math.*;
import java.util.*;

public class cal {
	static final double eps = 1e-9;
	
	public static void main(String args[]) throws Exception {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		double r = Double.parseDouble(st.nextToken());
		double s = Double.parseDouble(st.nextToken());
		double h = Double.parseDouble(st.nextToken());
		
		double diy = (r*Math.acos(-1.0)*2.0d)/(s*h);
		double diyr = Math.round(diy);
				
		int[] best = new int[3];
		double tmp;
		double gap = 2.0d;
		
		for(int n1 = 2; n1 <= 1000; n1++) {
			for(int n2 = 2*n1; n2 <= 1000; n2 += n1) {
				for(int n3 = 2*n2; n3 <= 1000; n3 += n2) {					
					if(diyr > diy)
						tmp = diyr - 1.0d/n1 + 1.0d/n2 - 1.0d/n3;
					else
						tmp = diyr + 1.0d/n1 - 1.0d/n2 + 1.0d/n3;
															
					if(Math.abs(diy-tmp) < gap) {
						gap = Math.abs(diy-tmp);
						best[0] = n1;
						best[1] = n2;
						best[2] = n3;
					}
				}
			}
		}
		
		for(int b : best)
			pw.print(b + " ");
		pw.println();
		pw.close();
	}
}

详细

Test #1:

score: 100
Accepted
time: 94ms
memory: 52688kb

input:

92998938 66660 24

output:

4 100 400 

result:

ok Output is valid!

Test #2:

score: 0
Accepted
time: 114ms
memory: 49220kb

input:

92998938 66660 25

output:

2 6 30 

result:

ok Output is valid!

Test #3:

score: 0
Accepted
time: 100ms
memory: 52780kb

input:

1 1 1

output:

3 15 60 

result:

ok Output is valid!

Test #4:

score: 0
Accepted
time: 71ms
memory: 52460kb

input:

1000000000 1000000 1000

output:

3 15 60 

result:

ok Output is valid!

Test #5:

score: 0
Accepted
time: 81ms
memory: 54768kb

input:

1000000000 1 1

output:

5 45 540 

result:

ok Output is valid!

Test #6:

score: 0
Accepted
time: 74ms
memory: 52320kb

input:

26373099 693335 239

output:

250 500 1000 

result:

ok Output is valid!

Test #7:

score: 0
Accepted
time: 82ms
memory: 52796kb

input:

116691234 213569 246

output:

12 24 360 

result:

ok Output is valid!

Test #8:

score: 0
Accepted
time: 87ms
memory: 52744kb

input:

50800597 848015 782

output:

2 50 750 

result:

ok Output is valid!

Test #9:

score: 0
Accepted
time: 90ms
memory: 50808kb

input:

735896038 135114 659

output:

12 72 648 

result:

ok Output is valid!

Test #10:

score: 0
Accepted
time: 96ms
memory: 52752kb

input:

366800924 611543 109

output:

2 10 40 

result:

ok Output is valid!

Test #11:

score: 0
Accepted
time: 92ms
memory: 52268kb

input:

522294156 301860 432

output:

6 432 864 

result:

ok Output is valid!

Test #12:

score: 0
Accepted
time: 72ms
memory: 52832kb

input:

408459747 702290 86

output:

2 114 684 

result:

ok Output is valid!

Test #13:

score: 0
Accepted
time: 88ms
memory: 50976kb

input:

483269997 328697 800

output:

2 20 380 

result:

ok Output is valid!

Test #14:

score: 0
Accepted
time: 97ms
memory: 52628kb

input:

10037736 216006 317

output:

12 180 900 

result:

ok Output is valid!

Test #15:

score: 0
Accepted
time: 88ms
memory: 51240kb

input:

335021997 211213 76

output:

5 15 570 

result:

ok Output is valid!

Test #16:

score: 0
Accepted
time: 85ms
memory: 54336kb

input:

628059082 935104 991

output:

2 4 120 

result:

ok Output is valid!