Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int divs[1009],w[1009];
- int n,cnt,c,i,j;
- for(i=1; i<=1000; i++){
- cnt = 1;
- n=i;
- for(j=2;j<=i;j++){
- c=0;
- while(n%j==0)
- {
- n=n/j;
- c++;
- }
- if(c!=0)
- cnt=cnt*(c+1);
- }
- divs[i]=cnt;
- }
- int wc=0;
- for(i=1;i<=1000;i++)
- {
- for(j=1000;j>=1;j--)
- {
- if(divs[j]==i){
- wc++;
- w[wc]=j;
- }
- }
- }
- int test,num;
- scanf("%d",&test);
- for(int i=1;i<=test;i++)
- {
- scanf("%d",&num);
- printf("Case %d: %d\n",i,w[num]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement