Submission #188392
Source Code Expand
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int start = 0; int ng1 = 0; int ng2 = 0; int ng3 = 0; for (int i = 0; i < 4; i++) { switch (i) { case 0: start = Integer.parseInt(br.readLine()); break; case 1: ng1 = Integer.parseInt(br.readLine()); if (ng1 == start) { System.out.println("NO"); } break; case 2: ng2 = Integer.parseInt(br.readLine()); if (ng2 == start) { System.out.println("NO"); } if (ng1 > ng2) { int temp = ng1; ng1 = ng2; ng2 = temp; } break; case 3: ng3 = Integer.parseInt(br.readLine()); if (ng3 == start) { System.out.println("NO"); } if (ng1 > ng3) { int temp = ng1; ng1 = ng3; ng3 = temp; } if (ng2 > ng3) { int temp = ng2; ng2 = ng3; ng3 = temp; } break; } } int sum = ng1 + ng2 + ng3; if (sum == 6 || sum == 894) { System.out.println("NO"); } else { sum = minReachLength(start, ng3 + 1); if (sum >= 100) { System.out.println("NO"); } else { int sum1 = sum + minReachLength(ng3 - 1, ng2 + 1); if (sum1 >= 100) { sum1 = sum + minReachLength(ng3 - 2, ng2 + 1); if (sum1 >= 100) { System.out.println("NO"); return; } } int sum2 = sum1 + minReachLength(ng2 - 1, ng1 + 1); if (sum2 >= 100) { sum2 = sum1 + minReachLength(ng2 - 2, ng1 + 1); if (sum2 >= 100) { System.out.println("NO"); return; } System.out.println("YES"); } else { System.out.println("YES"); } } } } private static int minReachLength(int start, int target) { int diff = start - target; int mod = diff % 3; int count = diff / 3; if (mod == 0) { return count; } else { return count + 1; } } }
Submission Info
Submission Time | |
---|---|
Task | C - 123引き算 |
User | jkojm23 |
Language | Java (OpenJDK 1.7.0) |
Score | 0 |
Code Size | 3181 Byte |
Status | WA |
Exec Time | 384 ms |
Memory | 20796 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | test_143_142_141_140.txt, test_1_1_2_3.txt, test_1_2_3_4.txt, test_200_200_2_3.txt, test_231_77_78_80.txt, test_235_124_126_125.txt, test_253_45_47_48.txt, test_297_223_224_225.txt, test_297_294_292_290.txt, test_297_297_30_83.txt, test_297_3_43_72.txt, test_298_125_123_124.txt, test_298_293_295_291.txt, test_298_298_4_8.txt, test_298_36_72_98.txt, test_298_55_3_43.txt, test_298_92_91_295.txt, test_299_200_151_65.txt, test_299_240_35_154.txt, test_299_300_299_298.txt, test_299_33_242_151.txt, test_299_56_57_58.txt, test_299_66_132_198.txt, test_300_271_44_68.txt, test_300_299_298_296.txt, test_300_30_99_183.txt, test_300_4_5_6.txt, test_84_34_64_36.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 363 ms | 20668 KB |
sample_02.txt | AC | 373 ms | 20664 KB |
sample_03.txt | WA | 374 ms | 20796 KB |
test_143_142_141_140.txt | WA | 366 ms | 20660 KB |
test_1_1_2_3.txt | WA | 366 ms | 20660 KB |
test_1_2_3_4.txt | AC | 372 ms | 20784 KB |
test_200_200_2_3.txt | WA | 372 ms | 20784 KB |
test_231_77_78_80.txt | AC | 364 ms | 20660 KB |
test_235_124_126_125.txt | WA | 362 ms | 20792 KB |
test_253_45_47_48.txt | AC | 363 ms | 20668 KB |
test_297_223_224_225.txt | WA | 370 ms | 20728 KB |
test_297_294_292_290.txt | AC | 371 ms | 20760 KB |
test_297_297_30_83.txt | WA | 362 ms | 20756 KB |
test_297_3_43_72.txt | AC | 369 ms | 20660 KB |
test_298_125_123_124.txt | WA | 370 ms | 20656 KB |
test_298_293_295_291.txt | WA | 367 ms | 20660 KB |
test_298_298_4_8.txt | WA | 371 ms | 20664 KB |
test_298_36_72_98.txt | AC | 369 ms | 20664 KB |
test_298_55_3_43.txt | AC | 379 ms | 20664 KB |
test_298_92_91_295.txt | AC | 380 ms | 20668 KB |
test_299_200_151_65.txt | AC | 375 ms | 20656 KB |
test_299_240_35_154.txt | AC | 375 ms | 20636 KB |
test_299_300_299_298.txt | WA | 374 ms | 20792 KB |
test_299_33_242_151.txt | WA | 374 ms | 20784 KB |
test_299_56_57_58.txt | WA | 378 ms | 20756 KB |
test_299_66_132_198.txt | AC | 378 ms | 20760 KB |
test_300_271_44_68.txt | AC | 382 ms | 20640 KB |
test_300_299_298_296.txt | AC | 377 ms | 20660 KB |
test_300_30_99_183.txt | WA | 384 ms | 20616 KB |
test_300_4_5_6.txt | AC | 381 ms | 20788 KB |
test_84_34_64_36.txt | AC | 380 ms | 20748 KB |