結果
| 問題 |
No.407 鴨等素数間隔列の数え上げ
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-07-28 13:52:08 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 338 bytes |
| コンパイル時間 | 2,920 ms |
| コンパイル使用メモリ | 280,568 KB |
| 実行使用メモリ | 51,748 KB |
| 最終ジャッジ日時 | 2025-07-28 13:52:14 |
| 合計ジャッジ時間 | 5,831 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 TLE * 1 -- * 1 |
| other | -- * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%lld %lld",&n,&l);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,l,ans=0;
map<int,bool> prm;
signed main()
{
scanf("%lld %lld",&n,&l);
for(int i=2; i<=l; i++)
{
if(prm[i])
continue;
for(int j=i; j<=l; j+=i)
prm[j]=false;
ll fst=l-i*(n-1)+1;
if(fst<=0)
break;
ans+=fst;
}
printf("%lld\n",ans);
return 0;
}
vjudge1