Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define f first
- #define se second
- vector<pair<int,int> > v(1001);
- bool cmp(pair<int,int>a,pair<int,int>b)
- {
- if(a.f<b.f)return 1;
- if(a.f>b.f) return 0;
- if(a.se>b.se)return 1;
- return 0;
- }
- int main()
- {
- int t;
- for(int i=1;i<=1000;i++)
- {
- v[i].f=0;
- v[i].se=i;
- }
- for(int i=1;i<=1000;i++)
- {
- for(int j=i;j<=1000;j+=i)
- {
- v[j].f++;
- }
- }
- sort(v.begin(),v.end(),cmp);
- cin>>t;
- for(int c=1;c<=t;c++)
- {
- int x;
- cin>>x;
- printf("Case %d: %d\n",c,v[x].se);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement