結果

問題 No.331 CodeRunnerでやれ
ユーザー GrenacheGrenache
提出日時 2015-12-24 00:45:14
言語 Java21
(openjdk 21)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,605 bytes
コンパイル時間 3,693 ms
コンパイル使用メモリ 74,676 KB
実行使用メモリ 65,224 KB
平均クエリ数 27.76
最終ジャッジ日時 2023-09-23 22:42:03
合計ジャッジ時間 12,251 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 269 ms
65,224 KB
testcase_01 AC 242 ms
55,560 KB
testcase_02 AC 321 ms
55,288 KB
testcase_03 AC 323 ms
55,472 KB
testcase_04 AC 311 ms
54,936 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Scanner;


public class Main_yukicoder331 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        int ph = 0;
        int prev = -1;
        int d = 0;
        while (true) {
        	String s = sc.nextLine();

        	if (s.equals("Merry Christmas!")) {
        		break;
        	}

        	int f = Integer.parseInt(s);

//        	pr.printf("f ph prev d %d %d %d %d\n", f, ph, prev, d);

        	if (f == 20151224) {
        		pr.println("F");
        		pr.flush();
        		ph = 99;
        		continue;
        	}

        	if (ph == 0) {
        		if (f == prev) {
        			ph = 1;
        			prev = -1;
        			pr.println("L");
        			pr.flush();
        			d++;
        			continue;
        		}
        		pr.println("B");
        		pr.flush();
        		prev = f;
        	} else if (ph == 1) {
        		if (d == 4) {
        			pr.println("F");
        			pr.flush();
        			d = 0;
        		} else if (d == 0 && f == prev) {
            		pr.println("L");
            		pr.flush();
            		prev = -1;
            		d = 0;
            		ph = 0;
        		} else {
        			if (d == 0) {
        				prev = f;
        			}
        			pr.println("L");
        			pr.flush();
        			d++;
        		}
        	} else if (ph == 2) {
        	} else {
        		pr.println("F");
        		pr.flush();
        	}
        }

        pr.close();
        sc.close();
    }

    /*
	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;

		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}

		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}

		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}
	*/

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0