結果

問題 No.36 素数が嫌い!
ユーザー 綾地寧々
提出日時 2015-07-22 08:48:11
言語 C90
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 536 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-07-08 11:46:00
合計ジャッジ時間 12,560 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other TLE * 1 -- * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%lld", &n);
      |         ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <math.h>

int main(void) {
	unsigned long long int i = 0;
	unsigned long int j = 0;
	unsigned char usable = 0;
	unsigned char is_prime = 1;
	unsigned long long int n = 0;
	unsigned long long int loop_max = 0;
	unsigned char fact_time = 0;

	scanf("%lld", &n);

	loop_max = n/2;
	for ( i=2; i<=(loop_max/2); i++ ) {
		while ( !(n % i) ) {
			n /= i;
			fact_time++;
		}
		if ( fact_time > 2 ) {
			usable = 1;
			break;
		}
	}

	if ( usable ) {
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}
	return 0;
}
0