/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 11ms 1.027 MiB
#3 Accepted 11ms 1.031 MiB
#4 Accepted 11ms 1.16 MiB
#5 Accepted 11ms 1.031 MiB
#6 Accepted 11ms 1.047 MiB
#7 Accepted 11ms 1.172 MiB
#8 Accepted 11ms 1.184 MiB
#9 Accepted 22ms 1.715 MiB
#10 Accepted 11ms 1.176 MiB

Code

#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
using namespace std;

void solve(int cs) {
  int n;
  cin >> n;
  vector<int> a = {6, 10, 15};
  for (int i = 12; (int)a.size() != n; i++) {
    if (i % a[0] == 0 || i % a[1] == 0 || i % a[2] == 0) {
      if (i != 15) {
        a.push_back(i);
      }
    }
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) cout << a[i] << " \n"[i == n - 1];
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  cin >> tc;
  for (int cs = 1; cs <= tc; cs++) {
    solve(cs);
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1070 Strange Sequences
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-15 03:42:28
Judged At
2024-11-11 03:21:56
Judged By
Score
100
Total Time
22ms
Peak Memory
1.715 MiB