結果
| 問題 |
No.371 ぼく悪いプライムじゃないよ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-05-24 21:31:30 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 416 bytes |
| コンパイル時間 | 243 ms |
| コンパイル使用メモリ | 23,808 KB |
| 実行使用メモリ | 22,400 KB |
| 最終ジャッジ日時 | 2024-10-07 06:45:08 |
| 合計ジャッジ時間 | 3,482 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 12 WA * 6 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("%d %d",&a,&b);
| ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(){
int a,b,i,j,*r;
int result = 0;
scanf("%d %d",&a,&b);
r=(int*)malloc(sizeof(int)*(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("%d\n",result);
return 0;
}