結果

問題 No.312 置換処理
コンテスト
ユーザー yamaken1343
提出日時 2015-12-09 22:32:40
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 356 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 219 ms
コンパイル使用メモリ 29,868 KB
最終ジャッジ日時 2026-02-23 20:00:43
ジャッジサーバーID
(参考情報)
judge5 / judge3
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%lld",&a);
      |     ^~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#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){
            if(c<3)c=i;
            d=a/i;
        }
    }
    b = c>d? d:c;
    
    if(b==1||a==4)printf("%lld\n",a);
    else if(b==2)printf("%lld\n",a/2);
    else printf("%lld\n",b);
    return 0;
}
0