QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#726642 | #7797. Based Zeros | Ln# | WA | 1ms | 3628kb | C++14 | 1.1kb | 2024-11-09 04:42:39 | 2024-11-09 04:42:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
short t; cin >> t;
while(t--){
int n; cin >> n;
vector<vector<int>> res(n);
int maxzeros = INT_MIN;
for(int i = 2;i <= sqrt(n); i++){
int temp = n, cnt = 0;
while(temp >= i){
if(temp % i == 0)
cnt++;
temp /= i;
}
if(cnt == maxzeros){
res[maxzeros].push_back(i);
}else if(cnt > maxzeros && cnt){
res[cnt].push_back(i);
maxzeros = cnt;
}
}
if(maxzeros == 1)res[maxzeros].push_back(n);
if(maxzeros < 1){
cout << "1 1\n" << n << '\n';
}
else{
cout << maxzeros << " " << res[maxzeros].size() << '\n';
for(int i : res[maxzeros])cout << i << ' ';
cout << '\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3628kb
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: 3512kb
input:
1 2
output:
1 1 2
result:
ok 3 number(s): "1 1 2"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
10 56 20 6 84 25 20 60 73 70 50
output:
3 1 2 3 1 2 1 2 2 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:
wrong answer 8th numbers differ - expected: '3', found: '2'