結果
問題 | No.36 素数が嫌い! |
ユーザー |
![]() |
提出日時 | 2015-09-02 11:18:47 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 50 ms / 5,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 23,936 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 00:25:43 |
合計ジャッジ時間 | 1,367 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:16:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%lld", &N); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> long long func(long long x){ long long i, sx = (long long)sqrt((double)x); if(x<3) return 0; if(x%2==0) return x/2; for(i=3;i<=sx;i+=2){ if(x%i==0) return x/i; } return 0; } int main(void){ long long N; scanf("%lld", &N); if(N<=7){ printf("NO\n"); }else{ if(func(func(N))>0){ printf("YES\n"); }else{ printf("NO\n"); } } return 0; }