結果
問題 | No.407 鴨等素数間隔列の数え上げ |
ユーザー | notetonous |
提出日時 | 2016-08-05 23:47:01 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 530 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 22,528 KB |
最終ジャッジ日時 | 2024-04-24 19:52:19 |
合計ジャッジ時間 | 4,444 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
コンパイルメッセージ
main.c: In function ‘main’: main.c:23:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | scanf("%d %d",&N,&L); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int prime[1000000]; int is_prime[5000000]; int p=0; int sieve(int n){ int i,j; for(i=0;i<=n;i++)is_prime[i]=1; is_prime[0]=is_prime[1]=0; for(i=2;i<=n;i++){ if(is_prime[i]==1){ prime[p++]=i; for(j=2*i;j<=n;j+=i)is_prime[j]=0; } } return p; } int main(){ int N,L; int i,j,x; long long int ans=0; scanf("%d %d",&N,&L); sieve(5000000); for(i=0;i<p;i++){ j=prime[i]*(N-1); if(j>L)break; else ans+=(L-j+1); } printf("%lld\n",ans); return 0; }