結果
問題 | No.293 4>7の世界 |
ユーザー | tom_tom_tom |
提出日時 | 2015-11-11 08:12:52 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,070 bytes |
コンパイル時間 | 4,092 ms |
コンパイル使用メモリ | 84,688 KB |
実行使用メモリ | 54,348 KB |
最終ジャッジ日時 | 2024-09-13 14:23:38 |
合計ジャッジ時間 | 8,203 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
52,880 KB |
testcase_01 | AC | 136 ms
54,164 KB |
testcase_02 | AC | 131 ms
53,804 KB |
testcase_03 | WA | - |
testcase_04 | AC | 131 ms
53,264 KB |
testcase_05 | WA | - |
testcase_06 | AC | 125 ms
53,124 KB |
testcase_07 | AC | 128 ms
53,124 KB |
testcase_08 | AC | 126 ms
53,192 KB |
testcase_09 | WA | - |
testcase_10 | AC | 127 ms
53,024 KB |
testcase_11 | AC | 124 ms
53,108 KB |
testcase_12 | AC | 124 ms
52,828 KB |
testcase_13 | AC | 123 ms
53,016 KB |
testcase_14 | AC | 126 ms
52,872 KB |
testcase_15 | WA | - |
testcase_16 | AC | 125 ms
53,216 KB |
testcase_17 | AC | 128 ms
53,332 KB |
testcase_18 | AC | 125 ms
52,836 KB |
testcase_19 | AC | 122 ms
53,132 KB |
testcase_20 | AC | 137 ms
54,348 KB |
testcase_21 | AC | 125 ms
52,940 KB |
testcase_22 | AC | 135 ms
54,332 KB |
testcase_23 | AC | 133 ms
54,020 KB |
ソースコード
package me.yukicoder; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; public class YukiCoder293 { private static boolean LOCAL = System.getenv().keySet().stream().anyMatch(key -> key.startsWith("JAVA_MAIN_CLASS")); public static void run() { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); String[] org = s.split(" "); String l = org[0]; String r = org[1]; s = s.replace('4', 'A'); s = s.replace('7', '4'); s = s.replace('A', '7'); String[] ss = s.split(" "); long a = Long.parseLong(ss[0]); long b = Long.parseLong(ss[1]); boolean left = false; if (a > b) { left = true; } System.out.println(left ? l : r); } private static TestCase getTest1() { return new TestCase("4", "4 7"); } private static TestCase getTest2() { return new TestCase("5", "5 7"); } private static TestCase getTest3() { return new TestCase("170", "40 170"); } private static TestCase getTest4() { return new TestCase("1234567890", "1237564890 1234567890"); } private static TestCase getTest5() { return new TestCase("", ""); } public static void main(String[] args) { perform(); } private static void perform() { if (LOCAL) { List<TestCase> tests = getTests(); boolean passed = true; int index = 1; for (TestCase testCase : getTests()) { String input = Arrays.stream(testCase.inputs).collect(joining(System.lineSeparator())); InputStream in = new ByteArrayInputStream(input.getBytes()); System.setIn(in); PrintStream sout = System.out; ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); System.setOut(ps); try { run(); } finally { System.setOut(sout); } System.out.flush(); String actual = baos.toString().trim(); String expect = testCase.expect; boolean match = expect != null && expect.equals(actual); System.out.println("------------------------ " + index++ + "/" + tests.size() + " " + (match ? "PASS" : "FAIL")); System.out.println("INPUT: " + input); System.out.println("RESULT: " + match); System.out.println("EXPECTED: " + expect + ":"); System.out.println("ACTUAL: " + actual + ":"); if (!match) passed = false; } System.out.println("\n==== SUMMARY ==== "); System.out.println(passed ? "PASS" : "FAIL"); } else { run(); } } public static List<TestCase> getTests() { List<TestCase> testCases = new ArrayList<>(); testCases.add(getTest1()); testCases.add(getTest2()); testCases.add(getTest3()); testCases.add(getTest4()); testCases.add(getTest5()); return testCases.stream().filter(t -> !t.ignore()).collect(toList()); } private static class TestCase { String expect; String[] inputs; public TestCase(String expect, String[] inputs) { this.expect = expect; this.inputs = inputs; } public TestCase(String expect, String input) { this.expect = expect; this.inputs = new String[]{input}; } public boolean ignore() { return "".equals(expect) && inputs.length == 1 && "".equals(inputs[0]); } } }