結果

問題 No.889 素数!
ユーザー pekempeypekempey
提出日時 2019-09-27 02:42:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 4,430 bytes
コンパイル時間 1,127 ms
コンパイル使用メモリ 80,184 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 15:57:26
合計ジャッジ時間 2,131 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

// https://github.com/pekempey/banana
// -------------------------------------------
// 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
// 
// let is_square n =
//   for i = 2 to n do
//     if i * i == n then return true
//   done;
//   false
//   in
// 
// let is_cube n =
//   for i = 2 to n do
//     if i * i * i == n then return true
//   done;
//   false
//   in
// 
// 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 and s == n
//   in
// 
// let n = readZ () 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>
template<class T> int print(T a) { std::cout << a; return 0; }
template<class T> int println(T a) { std::cout << a << '\n'; return 0; }
int print_newline(int dummy) { std::cout << '\n'; return 0; }
long long readZ(int dummy) { long long a; std::cin >> a; return a; }
long long readR(int dummy) { double a; std::cin >> a; return a; }
std::string readS(int dummy) { std::string a; std::cin >> a; return a; }
std::vector<long long> vecZ(long long n) { return std::vector<long long>(n, 0); }
std::vector<double> vecR(long long n) { return std::vector<double>(n, 0); }
long long sum(std::vector<long long> a) { long long res = 0; for (long long x : a) res += x; return res; }
template<class T> std::vector<T> sort(std::vector<T> a) { std::sort(a.begin(), a.end()); 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)->long long{
long long _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;
long long _24=0;
auto _25=_23==_24;
long long _29;
if(_25){
long long _26=0;
int _27=0;
return _26;
_29=_27;
} else {
long long _28=0;
_29=_28;
}
long long _30=1;
_13+=_30;
auto _31=_30;
}
auto _32=0;
auto &_33=_0;
long long _34=2;
auto _35=_33>=_34;
auto _36=_35;
auto _37=_36;
return _37;};
auto _3=[&](auto _2)->long long{
long long _38=2;
auto &_39=_2;
for(long long _12=_38;_12<=_39;_12++){
auto &_40=_12;
auto &_41=_12;
auto _42=_40*_41;
auto &_43=_2;
auto _44=_42==_43;
long long _48;
if(_44){
long long _45=1;
int _46=0;
return _45;
_48=_46;
} else {
long long _47=0;
_48=_47;
}
}
auto _49=0;
long long _50=0;
auto _51=_50;
return _51;};
auto _5=[&](auto _4)->long long{
long long _52=2;
auto &_53=_4;
for(long long _11=_52;_11<=_53;_11++){
auto &_54=_11;
auto &_55=_11;
auto _56=_54*_55;
auto &_57=_11;
auto _58=_56*_57;
auto &_59=_4;
auto _60=_58==_59;
long long _64;
if(_60){
long long _61=1;
int _62=0;
return _61;
_64=_62;
} else {
long long _63=0;
_64=_63;
}
}
auto _65=0;
long long _66=0;
auto _67=_66;
return _67;};
auto _7=[&](auto _6)->long long{
long long _68=0;
auto _9=_68;
long long _69=1;
auto &_70=_6;
long long _71=1;
auto _72=_70-_71;
for(long long _10=_69;_10<=_72;_10++){
auto &_73=_6;
auto &_74=_10;
auto _75=_73%_74;
long long _76=0;
auto _77=_75==_76;
long long _80;
if(_77){
auto &_78=_10;
_9+=_78;
_80=_78;
} else {
long long _79=0;
_80=_79;
}
}
auto _81=0;
auto &_82=_6;
long long _83=0;
auto _84=_82!=_83;
auto &_85=_9;
auto &_86=_6;
auto _87=_85==_86;
auto _88=_84&&_87;
auto _89=_88;
auto _90=_89;
return _90;};
long long _91=0;
auto _92=readZ(_91);
auto _8=_92;
auto &_93=_8;
auto _94=_1(_93);
long long _114;
if(_94){
std::string _95="Sosu!";
auto _96=println(_95);
_114=_96;
} else {
auto &_97=_8;
auto _98=_3(_97);
long long _113;
if(_98){
std::string _99="Heihosu!";
auto _100=println(_99);
_113=_100;
} else {
auto &_101=_8;
auto _102=_5(_101);
long long _112;
if(_102){
std::string _103="Ripposu!";
auto _104=println(_103);
_112=_104;
} else {
auto &_105=_8;
auto _106=_7(_105);
long long _111;
if(_106){
std::string _107="Kanzensu!";
auto _108=println(_107);
_111=_108;
} else {
auto &_109=_8;
auto _110=println(_109);
_111=_110;
}
_112=_111;
}
_113=_112;
}
_114=_113;
}
auto _115=_114;
int _116=_115;
int _117=_116;
int _118=_117;
int _119=_118;
}
0