結果
問題 |
No.441 和か積
|
ユーザー |
|
提出日時 | 2016-11-11 22:26:00 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,142 bytes |
コンパイル時間 | 3,090 ms |
コンパイル使用メモリ | 77,336 KB |
実行使用メモリ | 54,072 KB |
最終ジャッジ日時 | 2024-11-25 08:26:55 |
合計ジャッジ時間 | 7,680 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 4 |
ソースコード
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 (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; } } // --------------------------------------------------- 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); } } }