#include <iostream>
using namespace std;
int t2[100000000];
int main()
{
std::ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int n,w=0;
cin>>n;
int t1[n];
for(int i=0; i<n; ++i)
{
cin>>t1[i];
t2[t1[i]]++;
}
for (int k=1; k<=n; k++)
{
for(int i=0; i<100000000; ++i)
{
w=w+(t2[i]/k)*k;
}
cout<<w<<" ";
w=0;
}
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <iostream> using namespace std; int t2[100000000]; int main() { std::ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int n,w=0; cin>>n; int t1[n]; for(int i=0; i<n; ++i) { cin>>t1[i]; t2[t1[i]]++; } for (int k=1; k<=n; k++) { for(int i=0; i<100000000; ++i) { w=w+(t2[i]/k)*k; } cout<<w<<" "; w=0; } return 0; } |
English