#include<bits/stdc++.h>
#define N 1000
#define p pair<int, int>
using namespace std;
vector<p>v;
bool compare(p A, p B)
{
if(A.first < B.first)
return 1;
if(A.first > B.first)
return 0;
if(A.second > B.second)
return 1;
if(A.second < B.second)
return 0;
}
void divisors()
{
int i, j;
for(i=0;i<=N;i++)
{
v.push_back(p(0, i));
}
for(i=1;i<=N;i++)
{
for(j=i;j<=N;j+=i)
{
v[j].first++;
}
}
sort(v.begin(), v.end(), compare);
}
int main()
{
divisors();
int t, n, i=1;
cin >> t;
while(t--)
{
cin >> n;
cout << "Case " << i++ << ": " << v[n].second << "\n";
}
return 0;
}
#define N 1000
#define p pair<int, int>
using namespace std;
vector<p>v;
bool compare(p A, p B)
{
if(A.first < B.first)
return 1;
if(A.first > B.first)
return 0;
if(A.second > B.second)
return 1;
if(A.second < B.second)
return 0;
}
void divisors()
{
int i, j;
for(i=0;i<=N;i++)
{
v.push_back(p(0, i));
}
for(i=1;i<=N;i++)
{
for(j=i;j<=N;j+=i)
{
v[j].first++;
}
}
sort(v.begin(), v.end(), compare);
}
int main()
{
divisors();
int t, n, i=1;
cin >> t;
while(t--)
{
cin >> n;
cout << "Case " << i++ << ": " << v[n].second << "\n";
}
return 0;
}
Comments
Post a Comment