-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloj1109.cpp
62 lines (50 loc) · 815 Bytes
/
loj1109.cpp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using namespace std;
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
int arr[1010],mn[1010];
int divisor(int n)
{
int i,sqr=sqrt(n),count=0;
for(i=1;i<=sqr;i++)
{
if(n%i==0)
{
count+=2;
}
}
if((sqr*sqr)==n)
count--;
return count;
}
bool cmp(int a,int b)
{
if(arr[a]<arr[b])
return true;
if(arr[a]==arr[b])
{
if(a>b)
return true;
else
return false;
}
return false;
}
int main()
{
int t,i,Case=1,n;
scanf("%d",&t);
for(i=1;i<=1002;i++)
{
arr[i]=divisor(i);
mn[i]=i;
}
sort(mn+1,mn+1001,cmp);
while(t--)
{
scanf("%d",&n);
printf("Case %d: %d\n",Case++,mn[n]);
}
return 0;
}