結果

問題 No.889 素数!
ユーザー pekempeypekempey
提出日時 2019-10-02 18:39:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 4,400 bytes
コンパイル時間 685 ms
コンパイル使用メモリ 77,988 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 08:58:55
合計ジャッジ時間 2,631 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 2 ms
6,944 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
testcase_38 AC 2 ms
6,944 KB
testcase_39 AC 2 ms
6,944 KB
testcase_40 AC 2 ms
6,940 KB
testcase_41 AC 2 ms
6,940 KB
testcase_42 AC 2 ms
6,940 KB
testcase_43 AC 2 ms
6,940 KB
testcase_44 AC 2 ms
6,940 KB
testcase_45 AC 2 ms
6,940 KB
testcase_46 AC 2 ms
6,944 KB
testcase_47 AC 2 ms
6,940 KB
testcase_48 AC 2 ms
6,940 KB
testcase_49 AC 1 ms
6,940 KB
testcase_50 AC 2 ms
6,944 KB
testcase_51 AC 2 ms
6,940 KB
testcase_52 AC 2 ms
6,940 KB
testcase_53 AC 2 ms
6,944 KB
testcase_54 AC 2 ms
6,940 KB
testcase_55 AC 2 ms
6,944 KB
testcase_56 AC 2 ms
6,940 KB
testcase_57 AC 2 ms
6,940 KB
testcase_58 AC 2 ms
6,940 KB
testcase_59 AC 2 ms
6,944 KB
testcase_60 AC 2 ms
6,940 KB
testcase_61 AC 2 ms
6,940 KB
testcase_62 AC 2 ms
6,940 KB
testcase_63 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// https://github.com/pekempey/banana
// -------------------------------------------
// sig i32 -> bool
// let is_prime n =
//   let mut i = 2 in
//   while i * i <= n do
//     if n % i == 0 then return false;
//     i += 1
//   done;
//   n >= 2
//   in
// 
// sig i32 -> bool
// let is_square n =
//   for i = 2 to n do
//     if i * i == n then return true
//   done;
//   false
//   in
// 
// sig i32 -> bool
// let is_cube n =
//   for i = 2 to n do
//     if i * i * i == n then return true
//   done;
//   false
//   in
// 
// sig i32 -> bool
// let is_perfect n =
//   let mut s = 0 in
//   for i = 1 to n - 1 do
//     if n % i == 0 then
//       s += i
//   done;
//   n <> 0 && s == n
//   in
// 
// let n = readi32 () in
// if is_prime n then
//   println "Sosu!"
// else if is_square n then
//   println "Heihosu!"
// else if is_cube n then
//   println "Ripposu!"
// else if is_perfect n then
//   println "Kanzensu!"
// else
//   println n
// -------------------------------------------
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
struct unit {};
using i32 = int;
using i64 = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using string = std::string;
template<class T> unit print(T a) { std::cout << a; return unit(); }
template<class T> unit println(T a) { std::cout << a << '\n'; return unit(); }
template<class A> constexpr A power(A a, i32 b) { A res = 1; for (int i = 0; i < b; i++) res *= a; return res; }
i32 readi32(unit _) { i32 a; std::cin >> a; return a; }
i64 readi64(unit _) { i64 a; std::cin >> a; return a; }
u32 readu32(unit _) { u32 a; std::cin >> a; return a; }
u64 readu64(unit _) { u64 a; std::cin >> a; return a; }
string readstring(unit _) { string a; std::cin >> a; return a; }
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(15);
auto _1=[&](auto _0){
constexpr i32 _15=2;
auto _13=_15;
while(true){
auto &_16=_13;
auto &_17=_13;
auto _18=_16*_17;
auto &_19=_0;
auto _20=_18<=_19;
if(!(_20))break;
auto &_21=_0;
auto &_22=_13;
auto _23=_21%_22;
constexpr i32 _24=0;
auto _25=_23==_24;
unit _29;
if(_25){
constexpr bool _26=false;
unit _27;
return _26;
_29=_27;
} else {
unit _28;
_29=_28;
}
constexpr i32 _30=1;
_13+=_30;
unit _31;
auto _32=_31;
}
unit _33;
auto &_34=_0;
constexpr i32 _35=2;
auto _36=_34>=_35;
auto _37=_36;
auto _38=_37;
return _38;
};
auto _3=[&](auto _2){
constexpr i32 _39=2;
auto &_40=_2;
for(i32 _12=_39;_12<=_40;_12++){
auto &_41=_12;
auto &_42=_12;
auto _43=_41*_42;
auto &_44=_2;
auto _45=_43==_44;
unit _49;
if(_45){
constexpr bool _46=true;
unit _47;
return _46;
_49=_47;
} else {
unit _48;
_49=_48;
}
}
unit _50;
constexpr bool _51=false;
auto _52=_51;
return _52;
};
auto _5=[&](auto _4){
constexpr i32 _53=2;
auto &_54=_4;
for(i32 _11=_53;_11<=_54;_11++){
auto &_55=_11;
auto &_56=_11;
auto _57=_55*_56;
auto &_58=_11;
auto _59=_57*_58;
auto &_60=_4;
auto _61=_59==_60;
unit _65;
if(_61){
constexpr bool _62=true;
unit _63;
return _62;
_65=_63;
} else {
unit _64;
_65=_64;
}
}
unit _66;
constexpr bool _67=false;
auto _68=_67;
return _68;
};
auto _7=[&](auto _6){
constexpr i32 _69=0;
auto _9=_69;
constexpr i32 _70=1;
auto &_71=_6;
constexpr i32 _72=1;
auto _73=_71-_72;
for(i32 _10=_70;_10<=_73;_10++){
auto &_74=_6;
auto &_75=_10;
auto _76=_74%_75;
constexpr i32 _77=0;
auto _78=_76==_77;
unit _82;
if(_78){
auto &_79=_10;
_9+=_79;
unit _80;
_82=_80;
} else {
unit _81;
_82=_81;
}
}
unit _83;
auto &_84=_6;
constexpr i32 _85=0;
auto _86=_84!=_85;
auto &_87=_9;
auto &_88=_6;
auto _89=_87==_88;
auto _90=_86&&_89;
auto _91=_90;
auto _92=_91;
return _92;
};
unit _93;
auto _94=readi32(_93);
auto _8=_94;
auto &_95=_8;
auto _96=_1(_95);
unit _116;
if(_96){
std::string _97("Sosu!");
auto _98=println(_97);
_116=_98;
} else {
auto &_99=_8;
auto _100=_3(_99);
unit _115;
if(_100){
std::string _101("Heihosu!");
auto _102=println(_101);
_115=_102;
} else {
auto &_103=_8;
auto _104=_5(_103);
unit _114;
if(_104){
std::string _105("Ripposu!");
auto _106=println(_105);
_114=_106;
} else {
auto &_107=_8;
auto _108=_7(_107);
unit _113;
if(_108){
std::string _109("Kanzensu!");
auto _110=println(_109);
_113=_110;
} else {
auto &_111=_8;
auto _112=println(_111);
_113=_112;
}
_114=_113;
}
_115=_114;
}
_116=_115;
}
auto _117=_116;
unit _118=_117;
unit _119=_118;
unit _120=_119;
unit _121=_120;
}
0