結果

問題 No.441 和か積
ユーザー GrenacheGrenache
提出日時 2016-11-11 22:29:38
言語 Java19
(openjdk 21)
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 1,346 bytes
コンパイル時間 4,358 ms
コンパイル使用メモリ 73,824 KB
実行使用メモリ 56,708 KB
最終ジャッジ日時 2023-09-09 10:13:20
合計ジャッジ時間 8,666 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,592 KB
testcase_01 AC 119 ms
55,612 KB
testcase_02 AC 117 ms
56,068 KB
testcase_03 AC 120 ms
55,428 KB
testcase_04 AC 119 ms
56,120 KB
testcase_05 AC 119 ms
56,080 KB
testcase_06 AC 119 ms
55,508 KB
testcase_07 AC 119 ms
56,052 KB
testcase_08 AC 120 ms
55,444 KB
testcase_09 AC 117 ms
55,268 KB
testcase_10 AC 119 ms
55,432 KB
testcase_11 AC 120 ms
53,768 KB
testcase_12 AC 119 ms
55,424 KB
testcase_13 AC 118 ms
55,784 KB
testcase_14 AC 118 ms
55,676 KB
testcase_15 AC 120 ms
55,644 KB
testcase_16 AC 118 ms
55,608 KB
testcase_17 AC 118 ms
55,664 KB
testcase_18 AC 117 ms
56,708 KB
testcase_19 AC 120 ms
54,248 KB
testcase_20 AC 122 ms
56,136 KB
testcase_21 AC 123 ms
55,556 KB
testcase_22 AC 121 ms
55,888 KB
testcase_23 AC 119 ms
55,448 KB
testcase_24 AC 120 ms
55,688 KB
testcase_25 AC 120 ms
55,364 KB
testcase_26 AC 120 ms
56,088 KB
testcase_27 AC 119 ms
55,840 KB
testcase_28 AC 119 ms
55,216 KB
testcase_29 AC 122 ms
55,652 KB
testcase_30 AC 120 ms
55,492 KB
testcase_31 AC 120 ms
55,772 KB
testcase_32 AC 121 ms
55,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main_yukicoder441 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		String a = sc.next();
		String b = sc.next();

		if (isZero(a) && isZero(b)) {
			pr.println("E");
		} else if (isZero(a) && !isZero(b)) {
			pr.println("S");
		} else if (!isZero(a) && isZero(b)) {
			pr.println("S");
		} else if (isOne(a) || isOne(b)) {
			pr.println("S");
		} else if (a.length() == 1 && b.length() == 1) {
			int aa = Integer.parseInt(a);
			int bb = Integer.parseInt(b);

			if (aa + bb > aa * bb) {
				pr.println("S");
			} else if (aa + bb < aa * bb) {
				pr.println("P");
			} else {
				pr.println("E");
			}
		} else {
			pr.println("P");
		}
	}

	private static boolean isZero(String a) {
		if (a.length() == 1 && Integer.parseInt(a) == 0) {
			return true;
		} else {
			return false;
		}
	}

	private static boolean isOne(String a) {
		if (a.length() == 1 && Integer.parseInt(a) == 1) {
			return true;
		} else {
			return false;
		}
	}

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

		solve();

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

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