結果
| 問題 |
No.371 ぼく悪いプライムじゃないよ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-05-24 21:38:33 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 425 bytes |
| コンパイル時間 | 323 ms |
| コンパイル使用メモリ | 24,320 KB |
| 実行使用メモリ | 24,196 KB |
| 最終ジャッジ日時 | 2024-10-07 06:47:00 |
| 合計ジャッジ時間 | 3,613 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 18 TLE * 1 -- * 23 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%ld %ld",&a,&b);
| ^~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
long a,b,i,j,*r;
long result = 0;
scanf("%ld %ld",&a,&b);
r=(long*)malloc(sizeof(long)*(b-a+1));
for(i=a;i<=b;i++){
r[i-a]=0;
for(j=2;j<=sqrt(i);j++){
if(i%j==0){
r[i-a]=j;
break;
}
}
}
j=0;
for(i=a;i<=b;i++){
if(r[i-a]>=j){
j=r[i-a];
result = i;
}
}
printf("%ld\n",result);
return 0;
}