結果

問題 No.36 素数が嫌い!
ユーザー akakimidori
提出日時 2015-07-26 18:28:44
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 101 ms / 5,000 ms
コード長 405 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 00:22:03
合計ジャッジ時間 1,679 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%lld",&N);
      |         ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

typedef long long int ln;

int main(void){

	ln N;
	scanf("%lld",&N);

	if(N==1){
		printf("NO\n");
		return 0;
	}

	ln k;
	k=2;
	int count;
	count=0;
	while(k*k<=N && count < 2){
		if(N%k==0){
			count++;
			if(N!=k*k && N%(k*k)==0){
				printf("YES");
				return 0;
			}
		}
		k++;
	}

	if(count==2){
		printf("YES\n");
	} else {
		printf("NO\n");
	}

	return 0;
}
0