QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188275 | #1095. Brilliant Sequence of Umbrellas | As3b_team_f_masr# | WA | 13ms | 8312kb | C++14 | 968b | 2023-09-25 18:05:13 | 2023-09-25 18:05:13 |
Judging History
answer
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, 0, 0, 1, -1, 1};
int dj[] = {0, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18;
const int N = 2e6 + 5, M = 1e4 + 5, MOD = 1e9 + 7;
#define EPS 1e-9
ll n, q, a[N];
bool p[N];
vector<int>primes;
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//memset(dp, -1, sizeof dp);
ll n;
cin>>n;
primes.push_back(1);
primes.push_back(1);
for(ll i=2;i<N;i++)
{
if(!p[i])
{
primes.push_back(i);
for(ll j=i*i;j<N;j+=i)
{
p[j]=1;
}
}
}
vector<ll>ans;
for(int i=0;i<primes.size();i++)
{
if(1ll*primes[i]*primes[i+1]<=n)ans.push_back(1ll*primes[i]*primes[i+1]);
else break;
}
cout<<ans.size()<<'\n';
for(auto x:ans)cout<<x<<" ";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 8ms
memory: 6524kb
input:
10
output:
3 1 2 6
result:
ok OK.
Test #2:
score: 0
Accepted
time: 9ms
memory: 6588kb
input:
22
output:
4 1 2 6 15
result:
ok OK.
Test #3:
score: 0
Accepted
time: 8ms
memory: 6776kb
input:
2
output:
2 1 2
result:
ok OK.
Test #4:
score: 0
Accepted
time: 6ms
memory: 6536kb
input:
14
output:
3 1 2 6
result:
ok OK.
Test #5:
score: 0
Accepted
time: 4ms
memory: 7848kb
input:
15
output:
4 1 2 6 15
result:
ok OK.
Test #6:
score: 0
Accepted
time: 8ms
memory: 6660kb
input:
16
output:
4 1 2 6 15
result:
ok OK.
Test #7:
score: -100
Wrong Answer
time: 13ms
memory: 8312kb
input:
999999999999
output:
78500 1 2 6 15 35 77 143 221 323 437 667 899 1147 1517 1763 2021 2491 3127 3599 4087 4757 5183 5767 6557 7387 8633 9797 10403 11021 11663 12317 14351 16637 17947 19043 20711 22499 23707 25591 27221 28891 30967 32399 34571 36863 38021 39203 41989 47053 50621 51983 53357 55687 57599 60491 64507 67591 ...
result:
wrong answer Integer 78500 violates the range [666667, 1000000]