結果

問題 No.312 置換処理
ユーザー yamaken1343
提出日時 2015-12-09 22:20:53
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 23,552 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-15 06:00:30
合計ジャッジ時間 1,541 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%lld",&a);
      |         ^~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<math.h>
int main(void){
	long long int a,i,c,d,b;
	scanf("%lld",&a);
	for(i=1;i<=sqrt(a);i++){
		if(a%i == 0){c=i;
			if(i>=3)break;
		}
	}
	for(i=1;i<=sqrt(a);i++){
		if(a%i == 0) d=a/i;
	}
	b = c>d? d:c;
	
	if(c==1)printf("%lld\n",a);
	else if(c==2)printf("%lld\n",a/2);
	else printf("%lld\n",d);
	return 0;
}
0