QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#188263 | #1095. Brilliant Sequence of Umbrellas | As3b_team_f_masr# | WA | 6ms | 12756kb | C++14 | 970b | 2023-09-25 17:52:40 | 2023-09-25 17:52:41 |
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[N])
{
primes.push_back(i);
for(ll j=i*i;j<N;j+=i)
{
p[i]=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: 6ms
memory: 12756kb
input:
10
output:
3 1 2 6
result:
ok OK.
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 12304kb
input:
22
output:
5 1 2 6 12 20
result:
wrong answer GCD's are not sorted in increasing order!