結果
| 問題 | No.36 素数が嫌い! |
| コンテスト | |
| ユーザー |
testestest
|
| 提出日時 | 2015-08-10 04:42:31 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 50 ms / 5,000 ms |
| コード長 | 215 bytes |
| コンパイル時間 | 277 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 00:24:41 |
| 合計ジャッジ時間 | 1,252 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
main.c: In function ‘f’:
main.c:2:9: warning: implicit declaration of function ‘sqrt’ [-Wimplicit-function-declaration]
2 | int i,j=sqrt(x);
| ^~~~
main.c:1:1: note: include ‘<math.h>’ or provide a declaration of ‘sqrt’
+++ |+#include <math.h>
1 | long int f(long int x){
main.c:2:9: warning: incompatible implicit declaration of built-in function ‘sqrt’ [-Wbuiltin-declaration-mismatch]
2 | int i,j=sqrt(x);
| ^~~~
main.c:2:9: note: include ‘<math.h>’ or provide a declaration of ‘sqrt’
main.c: In function ‘main’:
main.c:13:1: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
13 | scanf("%ld",&a);
| ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
+++ |+#include <stdio.h>
1 | long int f(long int x){
main.c:13:1: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
13 | scanf("%ld",&a);
| ^~~~~
main.c:13:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:14:1: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration]
14 | puts(f(f(a))?"YES":"NO");
| ^~~~
main.c:14:1: note: include ‘<stdio.h>’ or provide a declaration of ‘puts’
ソースコード
long int f(long int x){
int i,j=sqrt(x);
if(x<3)return 0;
if(!(x%2))return x/2;
for(i=3;i<=j;i+=2){
if(!(x%i))return x/i;
}
return 0;
}
int main(){
long int a;
scanf("%ld",&a);
puts(f(f(a))?"YES":"NO");
return 0;
}
testestest