/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 4ms 584.0 KiB
#2 Wrong Answer 19ms 1.441 MiB

Code

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_N = 20000;
const int MAX_VAL = 100000;
vector<int> primes;
void sieve() {
    vector<bool> is_prime(MAX_VAL + 1, true);
    is_prime[0] = is_prime[1] = false;
    
    for (int i = 2; i <= MAX_VAL; ++i) {
        if (is_prime[i]) {
            primes.push_back(i);
            for (int j = i * 2; j <= MAX_VAL; j += i) {
                is_prime[j] = false;
            }
        }
    }
}
void solve() {
    int T;
    cin >> T;
    sieve();
    while (T--) {
        int N;
        cin >> N;
        vector<int> result;
        int current_value = 1;
        for (int i = 0; i < N; ++i) {
            result.push_back(current_value * primes[i]);
            current_value *= primes[i];
        }
        for (int i = 0; i < N; ++i) {
            cout << result[i] << " ";
        }
        cout << "\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    solve();
    
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1070 Strange Sequences
Contest
Brain Booster #4
Language
C++17 (G++ 13.2.0)
Submit At
2024-07-14 16:16:28
Judged At
2024-11-11 03:24:26
Judged By
Score
0
Total Time
19ms
Peak Memory
1.441 MiB