結果

問題 No.312 置換処理
ユーザー bal4u
提出日時 2019-04-19 13:16:36
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 438 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 30,592 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 11:23:52
合計ジャッジ時間 1,715 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

// yukicoder: No.312 置換処理
// 2019.4.19 bal4u

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

int main()
{
	int b, ans;
	long long N;

	scanf("%lld", &N);
	b = (int)sqrt((double)N);
	if ((N & 1) == 0) {
		int a = 2;
		N >>= 1;
		if (( N & 1) == 0) puts("4");
		else printf("%lld\n", N);
		return 0;
	}
	for (ans = 3; ans <= b; ans++) {
		if (N % ans == 0) break;
	}
	if (ans > b) printf("%lld\n", N);
	else printf("%d\n", ans);
	return 0;
}
0