QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#533051 | #8068. Building Roads | theodoregossett | WA | 88ms | 40064kb | Java8 | 1.2kb | 2024-08-25 16:24:46 | 2024-08-25 16:24:46 |
Judging History
answer
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] xCoordinates = new int[n];
int[] yCoordinates = new int[n];
for (int i = 0; i < n; i++) {
xCoordinates[i] = scanner.nextInt();
yCoordinates[i] = scanner.nextInt();
}
double min = 100000000;
for (int i = 0; i < n; i++) {
double max1 = 0;
double max2 = 0;
for (int j = 0; j < n; j++) {
int xDist = Math.abs(xCoordinates[i] - xCoordinates[j]);
int yDist = Math.abs(yCoordinates[i] - yCoordinates[j]);
double temp = Math.sqrt((double) (xDist * xDist) + (double) (yDist * yDist));
if (temp >= max1) {
max2 = max1;
max1 = temp;
} else if (temp > max2) {
max2 = temp;
}
}
min = Math.min(min, max1 + max2);
}
System.out.println(min);
scanner.close();
}
}
详细
Test #1:
score: 100
Accepted
time: 73ms
memory: 38976kb
input:
3 0 0 10 0 0 10
output:
20.0
result:
ok found '20.00000', expected '20.00000', error '0.00000'
Test #2:
score: 0
Accepted
time: 52ms
memory: 39364kb
input:
9 0 0 10 0 0 10 -10 0 0 -10 10 10 10 -10 -10 10 -10 -10
output:
28.284271247461902
result:
ok found '28.28427', expected '28.28427', error '0.00000'
Test #3:
score: 0
Accepted
time: 51ms
memory: 39116kb
input:
10 -5000 -5000 -4936 -4940 -4968 -4970 -4904 -4910 -4856 -4865 -4888 -4895 -4952 -4955 -4872 -4880 -4920 -4925 -4984 -4985
output:
197.38540979515176
result:
ok found '197.38541', expected '197.38541', error '0.00000'
Test #4:
score: 0
Accepted
time: 63ms
memory: 39104kb
input:
20 -4860 -4839 -4720 -4678 -4660 -4609 -4780 -4747 -4880 -4862 -5000 -5000 -4700 -4655 -4640 -4586 -4840 -4816 -4800 -4770 -4920 -4908 -4680 -4632 -4960 -4954 -4820 -4793 -4940 -4931 -4760 -4724 -4740 -4701 -4900 -4885 -4620 -4563 -4980 -4977
output:
579.1105248568705
result:
ok found '579.11052', expected '579.11052', error '0.00000'
Test #5:
score: 0
Accepted
time: 67ms
memory: 40064kb
input:
30 -4715 -4734 -4760 -4776 -4970 -4972 -4955 -4958 -4745 -4762 -4895 -4902 -4655 -4678 -4850 -4860 -4865 -4874 -4790 -4804 -4640 -4664 -4805 -4818 -4685 -4706 -4580 -4608 -4820 -4832 -4880 -4888 -4910 -4916 -4925 -4930 -4700 -4720 -4595 -4622 -4610 -4636 -4730 -4748 -4940 -4944 -4625 -4650 -4985 -49...
output:
595.0302513318125
result:
ok found '595.03025', expected '595.03025', error '0.00000'
Test #6:
score: 0
Accepted
time: 60ms
memory: 39468kb
input:
40 -4886 -4910 -4506 -4610 -4563 -4655 -4867 -4895 -4259 -4415 -4620 -4700 -4772 -4820 -4639 -4715 -4848 -4880 -4392 -4520 -4962 -4970 -4430 -4550 -4601 -4685 -4677 -4745 -4468 -4580 -4449 -4565 -4696 -4760 -5000 -5000 -4278 -4430 -4316 -4460 -4810 -4850 -4715 -4775 -4297 -4445 -4544 -4640 -4582 -46...
output:
944.090038078996
result:
ok found '944.09004', expected '944.09004', error '0.00000'
Test #7:
score: 0
Accepted
time: 78ms
memory: 38960kb
input:
50 -4256 -4690 -4280 -4700 -4448 -4770 -4424 -4760 -4472 -4780 -3920 -4550 -4520 -4800 -3848 -4520 -4304 -4710 -4616 -4840 -4832 -4930 -4808 -4920 -4352 -4730 -3968 -4570 -4880 -4950 -4376 -4740 -4160 -4650 -4184 -4660 -5000 -5000 -4904 -4960 -4664 -4860 -4208 -4670 -4040 -4600 -4328 -4720 -4640 -48...
output:
1274.0
result:
ok found '1274.00000', expected '1274.00000', error '0.00000'
Test #8:
score: 0
Accepted
time: 88ms
memory: 39944kb
input:
200 -4838 -4950 -4928 -4850 -4928 -4940 -4838 -4840 -4982 -4880 -5000 -4840 -4964 -4960 -4910 -4850 -4946 -4900 -4856 -4990 -4910 -4890 -4982 -4920 -4928 -4820 -4928 -4880 -5000 -4960 -4874 -4850 -4874 -4930 -4856 -4850 -4856 -4860 -4928 -4870 -4964 -4920 -4946 -4940 -4928 -4910 -4928 -4950 -5000 -4...
output:
261.81546108431564
result:
ok found '261.81546', expected '261.81546', error '0.00000'
Test #9:
score: -100
Wrong Answer
time: 80ms
memory: 39932kb
input:
200 -4847 -4928 -4643 -4928 -4847 -4904 -4694 -4928 -4711 -5000 -4762 -4952 -4728 -4952 -4609 -5000 -4490 -4904 -4932 -5000 -5000 -5000 -4966 -4928 -4456 -4928 -4541 -4976 -4490 -4976 -4371 -4952 -4609 -4928 -4660 -4976 -5000 -4904 -4456 -4904 -4575 -4928 -4592 -4976 -4592 -4904 -4813 -4976 -4337 -4...
output:
686.7430378241922
result:
wrong answer 1st numbers differ - expected: '670.09417', found: '686.74304', error = '0.02485'