摘要:
有n盏灯,编号1~n。第1个人把所有灯打开,第2个人按下所有编号为2的倍数的开关(这些灯将被关掉),第3个人按下所有编号为3的倍数的开关(其中关掉的灯将被打开,开着的灯将被关闭),依次类推。一共有k个人,问最后由哪些灯开着? 输入n和k,1≤k≤n≤1000。输出开着的灯编号。样例输入7 3样例输出...
阅读全文
posted @ 2014-07-17 15:52
lipching
阅读(136)
推荐(0)
编辑
摘要:
用1,2,3……9组成3个三位数abc,def和ghi,每个数字恰好使用一次,要求abc:def:ghi = 1:2:3。输出所有解。提示:不必太动脑筋。分析:利用数组,a[1]~a[9]赋值为0,令a[出现的数字] = 1,若a[1] + a[2] + …… +a[9] == 9,则全部数字都出现...
阅读全文
posted @ 2014-07-17 14:48
lipching
阅读(116)
推荐(0)
编辑
摘要:
题目:输入正整数a,b,c,输出a/b的小数形式,精确到小数点后c位。a,b #include#includeint main(){ int a,b,c,x,y,mod,m,r,i; while(~scanf("%d %d %d",&a,&b,&c)) { print...
阅读全文
posted @ 2014-07-17 14:29
lipching
阅读(185)
推荐(0)
编辑
摘要:
输入两个正整数nint main(){ int n,m,i; double sum; while(~scanf("%d %d",&n,&m)) { sum=0; for(i=n;i<=m;i++) { sum+=...
阅读全文
posted @ 2014-07-17 13:48
lipching
阅读(209)
推荐(1)
编辑
摘要:
题目:输入一个正整数n,然后读取n个正整数a1, a2, a3...,an,最后再读取一个正整数m。统计数列中多少个正整数的值小于m。代码:#include #include void main(){ int i,n,m,number=0; int *p; scanf("%d", ...
阅读全文
posted @ 2014-07-17 13:41
lipching
阅读(295)
推荐(0)
编辑
摘要:
The Famous Clock Time Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluMr. B, Mr. G and Mr. M are now in Warsaw, Poland, for the 2012’s ACM-ICP...
阅读全文
posted @ 2014-07-17 11:23
lipching
阅读(319)
推荐(0)
编辑
摘要:
A Famous City Time Limit:7000MSMemory Limit:0KB64bit IO Format:%lld & %lluAfter Mr. B arrived in Warsaw, he was shocked by the skyscrapers and took se...
阅读全文
posted @ 2014-07-17 11:21
lipching
阅读(503)
推荐(0)
编辑
摘要:
A Famous ICPC Team Time Limit:1000MSMemory Limit:0KB64bit IO Format:%lld & %lluMr. B, Mr. G, Mr. M and their coach Professor S are planning their way...
阅读全文
posted @ 2014-07-17 11:18
lipching
阅读(294)
推荐(0)
编辑