結果

問題 No.36 素数が嫌い!
ユーザー 小指が強い人
提出日時 2016-01-01 13:28:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 101 ms / 5,000 ms
コード長 623 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 61,544 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 00:37:38
合計ジャッジ時間 2,061 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <math.h>
#include <vector>
using namespace std;

int main(void)
{
    long long n;
    cin >> n;
    if(n == 1) {
        cout << "NO" << endl;
        exit(0);
    }
    long long sh = sqrt(n);
    bool find = false;
    for(long long i = 2; i <= sh; i++) {
        if(n % i == 0) {
            if(find) {
                cout << "YES" << endl;
                exit(0);
            }
            if(n % (i * i) == 0 && n != i * i) {
                cout << "YES" << endl;
                exit(0);
            }
            find = true;
        }
    }
    cout << "NO" << endl;
    return 0;
}
0