QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#726635 | #7797. Based Zeros | Ln# | RE | 1ms | 3832kb | C++14 | 1.0kb | 2024-11-09 04:32:46 | 2024-11-09 04:32:47 |
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);
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: 3832kb
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: -100
Runtime Error
input:
1 2