周赛
2016-08-25 17:27
183 查看
H 圆周率用acos(-1.0) 使用longlong
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ
1109
uDebug
Description
We define b is a Divisor of a number a if a is divisible by b. So, the divisors of 12 are 1, 2, 3, 4, 6, 12. So, 12 has 6 divisors.
Now you have to order all the integers from 1 to 1000. x will come before y if
1) number of divisors of x is less than number of divisors of y
2) number of divisors of x is equal to number of divisors of y and x > y.
Input
Input starts with an integer T (≤ 1005), denoting the number of test cases.
Each case contains an integer n (1 ≤ n ≤ 1000).
Output
For each case, print the case number and the nth number after ordering.
Sample Input
5
1
2
3
4
1000
Sample Output
Case 1: 1
Case 2: 997
Case 3: 991
Case 4: 983
Case 5: 840
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu
Submit Status Practice LightOJ
1109
uDebug
Description
We define b is a Divisor of a number a if a is divisible by b. So, the divisors of 12 are 1, 2, 3, 4, 6, 12. So, 12 has 6 divisors.
Now you have to order all the integers from 1 to 1000. x will come before y if
1) number of divisors of x is less than number of divisors of y
2) number of divisors of x is equal to number of divisors of y and x > y.
Input
Input starts with an integer T (≤ 1005), denoting the number of test cases.
Each case contains an integer n (1 ≤ n ≤ 1000).
Output
For each case, print the case number and the nth number after ordering.
Sample Input
5
1
2
3
4
1000
Sample Output
Case 1: 1
Case 2: 997
Case 3: 991
Case 4: 983
Case 5: 840
#include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; struct node{ int shi,jia; }shu[1010]; void geshu() { for(int i=1;i<=1000;i++) { int sum=0; for(int j=1;j<=i;j++) { if(i%j==0) sum++; } shu[i].jia=sum; shu[i].shi=i; } } bool cmp(node x,node y) { if(x.jia==y.jia){//这里要逻辑清晰;;;; return x.shi>y.shi; } else{ return x.jia<y.jia; } } int main() { int t,n,cont=0; scanf("%d",&t); geshu(); sort(shu+1,shu+1000+1,cmp); while(t--) { scanf("%d",&n); printf("Case %d: %d\n",++cont,shu .shi); } return 0; }//HHHHHHHHHH
相关文章推荐
- 周赛(1)——素数
- SDUT 第九周周赛
- 周赛 HDU 2767 1269 1872 强连通
- 周赛A山谷
- 周赛题目 福州 最长队名
- 十八周周赛D题Prizes, Prizes, more Prizes
- 2014_3_29_周赛 倒水
- 周赛 POJ 3546 The Dragon of Loowater
- 2015 年 JXNU_ACS 算法组寒假第一次周赛 1004 盘古开天辟地
- 中大周赛15年第6场
- 周赛-Integration of Polynomial
- 周赛题目
- Integration of Polynomial (周赛1)
- 周赛 Hdoj 5146
- 周赛 大数找规律
- 周赛 4 【kMP&&回文串】
- 第0周周赛——极限手速赛(题解)之下篇
- AYIT606第七周周赛(动态规划) A - How many ways
- 周赛
- 周赛总结(11.13)