QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#591455#7797. Based ZerosStrausKoldunTL 170ms3836kbC++17852b2024-09-26 16:00:292024-09-26 16:00:29

Judging History

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

  • [2024-09-26 16:00:29]
  • 评测
  • 测评结果:TL
  • 用时:170ms
  • 内存:3836kb
  • [2024-09-26 16:00:29]
  • 提交

answer

#include <bits/stdc++.h>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;

void solve() {
  int n;
  cin >> n;
  auto foo = [](int n, int base)
  {
    int res = 0;
    while (n != 0)
    {
      res += (n % base) == 0;
      n /= base;
    }
    return res;
  };
  pair<int, vector<int>> ans = {0, {}};
  for (int i = 2; i < 1e6; i++)
  {
    auto del = foo(n, i);
    if(ans.first == del){
      ans.second.push_back(i);
      continue;
    }
    if(ans.first < del){
      ans = {del, {i}};
      continue;
    }
  }
  cout << ans.first << " " << ans.second.size() << '\n';
  for (auto i : ans.second){
    cout << i << ' ';
  }
  cout << '\n';
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}

详细

Test #1:

score: 100
Accepted
time: 6ms
memory: 3800kb

input:

3
11
1007
239

output:

1 3
2 3 11 
2 2
3 10 
1 4
2 6 15 239 

result:

ok 15 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1
2

output:

1 1
2 

result:

ok 3 number(s): "1 1 2"

Test #3:

score: 0
Accepted
time: 18ms
memory: 3600kb

input:

10
56
20
6
84
25
20
60
73
70
50

output:

3 1
2 
3 1
2 
1 3
2 3 6 
4 1
2 
2 2
2 5 
3 1
2 
2 2
2 3 
4 1
2 
4 1
2 
3 1
2 

result:

ok 34 numbers

Test #4:

score: 0
Accepted
time: 170ms
memory: 3836kb

input:

100
6211
4783
6225
5664
9709
5455
5424
7394
2329
3880
8260
950
2604
1366
3080
5505
4983
9595
6563
2697
2249
675
1537
5884
6070
2905
3137
5675
8138
1626
5348
8876
6065
8454
9346
3421
8857
8941
2743
9343
6201
45
1651
8575
5327
2577
4553
7595
1185
8775
7241
616
4465
3642
1657
5791
2800
1669
9307
2640
6...

output:

8 1
2 
5 1
2 
8 1
2 
9 1
2 
5 1
2 
5 1
2 
8 1
2 
6 1
2 
7 1
2 
6 1
2 
11 1
2 
3 1
2 
7 1
2 
5 1
2 
9 1
2 
8 1
2 
4 1
2 
5 1
2 
7 1
3 
7 1
2 
7 1
2 
5 1
2 
8 1
2 
4 1
2 
4 1
2 
5 1
2 
8 1
2 
6 1
2 
4 1
2 
5 1
2 
7 1
2 
8 1
2 
5 1
2 
10 1
2 
10 1
2 
4 1
2 
8 1
2 
6 1
2 
4 1
2 
5 1
2 
7 1
2 
2 2
2 3 
4...

result:

ok 309 numbers

Test #5:

score: -100
Time Limit Exceeded

input:

1000
461349
350342
809551
211152
572968
896101
718511
44614
72871
106360
141199
858436
576392
414585
897161
917037
679916
987675
507878
851589
62793
717573
119037
587678
774831
977964
313698
208868
953676
26986
273250
625834
573172
865274
105345
290197
807126
566514
193786
645978
670847
961765
72414...

output:


result: