結果
問題 | No.36 素数が嫌い! |
ユーザー | hanorver |
提出日時 | 2017-07-08 11:51:40 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 106 ms / 5,000 ms |
コード長 | 3,740 bytes |
コンパイル時間 | 1,148 ms |
コンパイル使用メモリ | 85,112 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 01:10:45 |
合計ジャッジ時間 | 3,583 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 49 ms
6,816 KB |
testcase_01 | AC | 81 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 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 | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 3 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 36 ms
6,940 KB |
testcase_12 | AC | 105 ms
6,944 KB |
testcase_13 | AC | 102 ms
6,940 KB |
testcase_14 | AC | 67 ms
6,944 KB |
testcase_15 | AC | 2 ms
6,944 KB |
testcase_16 | AC | 2 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,944 KB |
testcase_18 | AC | 2 ms
6,944 KB |
testcase_19 | AC | 41 ms
6,944 KB |
testcase_20 | AC | 106 ms
6,940 KB |
testcase_21 | AC | 79 ms
6,940 KB |
testcase_22 | AC | 82 ms
6,940 KB |
testcase_23 | AC | 50 ms
6,940 KB |
testcase_24 | AC | 69 ms
6,944 KB |
testcase_25 | AC | 54 ms
6,940 KB |
testcase_26 | AC | 96 ms
6,944 KB |
testcase_27 | AC | 91 ms
6,940 KB |
testcase_28 | AC | 95 ms
6,944 KB |
testcase_29 | AC | 100 ms
6,944 KB |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <cmath> #include <map> #include <stack> #include <queue> #include <cstdlib> #include <numeric> /* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::'''```````::::::::::::::::::: ::::::::::::::::::::::::::::::::::::::::''`_,-''.,... `:::::::::::::::::: :::::::::::::::::::::::::::::::::::::' _,-',;;!!!!!!!!!; `:::::::::::::::: ::::::::::::::'`````:::::::::::::'' .-' ;<!!!!!!!'''`_..' `::::::::::::::: ::::::::::'' ,;!!!;,`::::::::::' .-`.,,,zcccc,,cccd$$"",;> `:::::::::::::: :::::::::' ;!!!!!!!!; ``:::::' ;' ,c$$$$$$$$$$$CC<<" ````_ :::::::::::::: :::::::' ;!!!!!!!!!!!!!; ' ;! z$$$$$$$$$$$$$$$$$$$$$$??". :::::::::::::: ::::::: <!!!!!!!!!!!!!' . .!',c$$$$$$$$$$$$$c, `"""',;;<!! :::::::::::::: :::::: ,!!!!!!!!!!!'`,;! .<! ,$$$$$$$$$$$$$$$$hc,,,..- !!!! `::::::::::::: ::::' <!!!!!!!!!' .<!!!;!! ,$$$$$""???$$$"""?????"" .<!!!! :::::::::::::: ::: ;><!!!!!!!!! ,<!!!!!!!',c, "??.< . "??h. -;;;;!!!!!!!' :::::::::::::: ::: !!!!!!!!!!' ;!!!!!!!!' d$$h.`$ccr,$h `;,." `!!!!!!!!! ::::::::::::::: :::.`<!!!!!!!' !!!!!!!!!! dP"""?.`$$F`$$h.`!!!!!!!!!!!!!! .::::::::::::::: ::::. <!!!!!! !!!!!!!!!! ,$ .nn.' "$$ P" <!!!!!!!!!!!' .:::::::::::::::: :::::. <!!!! ;!!!!!!!!!! $$ MMMMx ?$ ,dx `!!!!!!!!!!' :::::::::::::::::: ```:::: `!!! !!!'!!!!!! `$ MMMMMM, $r MMMr !!!!!!!!' .::::::::::::::::::: `!!;,.`' ``' ``,;!!!!' ch." 4MMMMMM "$ 4MMM `!!!!!' ..:::::::::::::::::::: !!!!!'````'``<!!!'`.z$$$$. MMMMMMb $h MMM `!!'' .::::::::::::::::::::::: ..``.,d$$$$$c,,,. $$$$$F"? "MMMMMM $$ 4P" ' . :::::::::::::::::::::::::: dM""..""?$$$$$$$$$$$$$$$$$$c "MM" $$>` ,c `::::::::::::::::::::::::: MMn.`"?hc,d$$$$$$$$$$$$$$$$$$. `P $P' -??P== `::::::::::::::::::::::: MMMMMnx`"?$$$$$$$$$$$P".,.`"??$ccccc$.z$$$$. `' .:::::::::::::::::' '' MMMMMM,' .?$$$$$$$$$$ d$$$ d$$$$$$$$$$$$$h..``::::::::::::::::' MMMMMMMn `?$$$$$$$$$$,.?$$h. =."?$$$$$$$$$$$$$$hc,.``'::::::::::' MMMMMMMM ;, `"??$$$$$$h ?$$h. -m,``""??$$$$$$$$$$$$$c,.``````' MMMMMMM> !!! ?cc,.,d$$$$h.`"?$hc `P .`"?$$$$$$$$$$$$$$$$$$$ .: MMMMMMM ,!!'. $$$$$$$$$??=== `"""=c, " P n. "$$$$$$$$$$$$$$$$c_ ,.:::: MMMMMMP !!! Mr<$$$$"".,c,;M ;<!! ..""=_ ' 4 .br .`""??$$$$$$$$??"".::::::: MMMMMM';!!',M>'$$$$$$$$$>4M `!!! 4MMbn.`"=cc," -'P",c=.,.`.. .= ::::::::: MMMMM' !!! dMb $$$$$$$$P MM> !!! 4MMMMMMr :..`"-._""Pr4"'-P" .,.`::::::::: MMMM' <!!!,MMM "$$$$$$P dMM>;!!! 4MMMMMMb :::::.. "-=cczyycc??" .::::::::: MMMP <!!! dMMMb "?$$P" uMMM>;!!! 4MMMMMMMr`:::::::::.........::::::::::::: MMP';!!! ;MMMMMMn,.".uMMMMM ;!!! MMMMMMMMM,`:::::::::::::::::::::::::::::: MM ;!!!! MMMMMMMMMMMMMMMMMM !!!! MMMMMMMMMb `::::::::::::::::::::::::::::: M" !!!! uMMMMMMMMMMMMMMMMMP !!! ;MMMMMMMMMMx ::::::::::::::::::::::::::::: P.!!!! ,MMMMMMMMMMMMMMMMMM ,!!! MMMMMMMMMMMMx`:::::::::::::::::::::::::::: !!!!> MMMMMMMMMMMMMMMMMMP !!!',MMMMMMMMMMMMM `::::::::::::::::::::::::::: */ long long pow(long long a, long long b) { long long ans = 1; for (long long i = 0; i < b; i++) { ans *= a; } return ans; } int main() { long long n; std::cin >> n; std::vector<long long> num; for (long long i = 2; i * i <= n; i++) { if (i * i == n) { num.push_back(i); } else if (n % i == 0) { num.push_back(i); num.push_back(n / i); } } if (n == 1 || num.size() == 0) { std::cout << "NO" << std::endl; return 0; } for (long long i : num) { for (long long j = 2; j * j <= i; j++) { if (i % j == 0) { std::cout << "YES" << std::endl; return 0; } } } std::cout << "NO" << std::endl; return 0; }