結果
| 問題 |
No.441 和か積
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-11 22:29:38 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 134 ms / 1,000 ms |
| コード長 | 1,346 bytes |
| コンパイル時間 | 3,670 ms |
| コンパイル使用メモリ | 78,436 KB |
| 実行使用メモリ | 56,044 KB |
| 最終ジャッジ日時 | 2024-06-27 03:22:34 |
| 合計ジャッジ時間 | 8,711 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
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);
}
}
}