QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#188383#1095. Brilliant Sequence of UmbrellasAs3b_team_f_masr#WA 1ms3544kbC++14690b2023-09-25 19:45:232023-09-25 19:45:23

Judging History

你现在查看的是最新测评结果

  • [2023-09-25 19:45:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3544kb
  • [2023-09-25 19:45:23]
  • 提交

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 = 1e6 + 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;

    vector<ll>ans;
    ans.push_back(1);
    for(int i=1;i<N;i++)
    {
        if(1ll*i*(i+1)>n)break;
        ans.push_back(1ll*i*(i+1));
    }
    cout<<ans.size()<<'\n';
    for(auto x:ans)cout<<x<<" ";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3544kb

input:

10

output:

3
1 2 6 

result:

ok OK.

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3428kb

input:

22

output:

5
1 2 6 12 20 

result:

wrong answer GCD's are not sorted in increasing order!