結果

問題 No.889 素数!
ユーザー takeya_okinotakeya_okino
提出日時 2019-09-28 16:43:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 748 bytes
コンパイル時間 2,202 ms
コンパイル使用メモリ 75,024 KB
実行使用メモリ 54,384 KB
最終ジャッジ日時 2024-04-10 10:01:17
合計ジャッジ時間 12,616 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
54,216 KB
testcase_01 AC 131 ms
53,928 KB
testcase_02 AC 133 ms
53,976 KB
testcase_03 AC 136 ms
53,960 KB
testcase_04 AC 134 ms
54,056 KB
testcase_05 AC 134 ms
53,924 KB
testcase_06 AC 134 ms
53,944 KB
testcase_07 AC 135 ms
53,888 KB
testcase_08 AC 135 ms
54,100 KB
testcase_09 AC 136 ms
54,216 KB
testcase_10 AC 137 ms
54,116 KB
testcase_11 AC 135 ms
54,152 KB
testcase_12 AC 138 ms
54,256 KB
testcase_13 AC 135 ms
54,144 KB
testcase_14 AC 134 ms
54,260 KB
testcase_15 AC 133 ms
53,996 KB
testcase_16 AC 138 ms
54,012 KB
testcase_17 AC 134 ms
53,728 KB
testcase_18 AC 133 ms
54,048 KB
testcase_19 AC 134 ms
53,972 KB
testcase_20 AC 131 ms
54,132 KB
testcase_21 AC 133 ms
54,088 KB
testcase_22 AC 131 ms
53,956 KB
testcase_23 AC 131 ms
54,060 KB
testcase_24 AC 135 ms
54,164 KB
testcase_25 AC 136 ms
54,204 KB
testcase_26 AC 132 ms
54,168 KB
testcase_27 AC 133 ms
54,024 KB
testcase_28 AC 134 ms
54,008 KB
testcase_29 AC 132 ms
54,008 KB
testcase_30 AC 135 ms
54,260 KB
testcase_31 AC 133 ms
54,032 KB
testcase_32 AC 135 ms
53,912 KB
testcase_33 AC 132 ms
54,112 KB
testcase_34 AC 132 ms
54,120 KB
testcase_35 AC 132 ms
54,096 KB
testcase_36 AC 136 ms
54,156 KB
testcase_37 AC 133 ms
54,164 KB
testcase_38 AC 135 ms
53,972 KB
testcase_39 AC 136 ms
54,024 KB
testcase_40 AC 134 ms
54,012 KB
testcase_41 AC 131 ms
54,088 KB
testcase_42 AC 133 ms
54,016 KB
testcase_43 AC 135 ms
54,004 KB
testcase_44 AC 133 ms
54,208 KB
testcase_45 AC 133 ms
53,856 KB
testcase_46 AC 129 ms
54,228 KB
testcase_47 AC 136 ms
54,384 KB
testcase_48 AC 134 ms
53,964 KB
testcase_49 AC 131 ms
53,944 KB
testcase_50 AC 133 ms
54,000 KB
testcase_51 AC 134 ms
54,256 KB
testcase_52 AC 134 ms
53,996 KB
testcase_53 AC 132 ms
54,316 KB
testcase_54 AC 134 ms
54,244 KB
testcase_55 AC 133 ms
54,088 KB
testcase_56 AC 133 ms
53,864 KB
testcase_57 AC 132 ms
54,048 KB
testcase_58 AC 132 ms
54,096 KB
testcase_59 AC 133 ms
54,132 KB
testcase_60 AC 133 ms
54,000 KB
testcase_61 AC 134 ms
54,104 KB
testcase_62 AC 134 ms
54,228 KB
testcase_63 AC 131 ms
53,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String ans = String.valueOf(n);
    int p = 0;
    int prime = 0;
    int sum = 1;
    if(n >= 2) {
      for(int i = 2; i < n; i++) {
        if((n % i) == 0) {
          prime++;
          sum += i;
          if((i * i) == n) p = 2;
          if((i * i * i) == n) p = 3;
        }
      }
      if(prime == 0) p = 1;
      if(sum == n) p = 4;
      if(p == 1) {
        ans = "Sosu!";
      } else if(p == 2) {
        ans = "Heihosu!";
      } else if(p == 3) {
        ans = "Ripposu!";
      } else if(p == 4) {
        ans = "Kanzensu!";
      }
    }
    System.out.println(ans);
  }
}
0