摘要: DescriptionA pretty straight forward task, calculate the number of primes between 2 integers. Given 2 integers A ≤ B < 105 what’s the number of primes in range from A to B inclusive. Note: A prime number is a positive integer greater than 1 and is divisible by 1 and itself only. For N to be prime 阅读全文
posted @ 2011-11-26 22:24 狸の舞 阅读(424) 评论(0) 推荐(0) 编辑
摘要: Description输入一个由字母a~z或A~Z组成的字符串。您的任务就是,编程统计不区分大小写的相同字母个数,并输出统计后的字母数字串。输出时字母只能大写,且按A到Z的顺序。如果字符个数是1,则省略该数字。 例如,如果给出字符串eAaBbCacABcBC,统计知道E有1个、A有4个、B有4个、C有4个。于是,输出字母数字串为A4B4C4E。Input输入可以有多个测试用例。每个测试用例是一行由大小写字母组成的字符串(1<=串长<=200)。如果读入的字符串首字符为数字0,表示结束且该行不需要处理。Output每个测试用例输出一行,即统计后的字母数字串,并按字母的ASCII码大小 阅读全文
posted @ 2011-11-26 21:37 狸の舞 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Description倘若一个数它的立方的后三位全是1,我们称此类数为神秘数。现在我们想知道第K个这样的数是多少,相信你能解决。Input输入一个正整数K,直到文件结束,K的位数最多100位。Output输出第K个数,占一行Sample Input1Sample Output471#include<stdio.h>#include<string.h>int main(){ char str[120]; int i, j, t, k; while( gets( str ) ) { int len; len = strlen( str ); t = 0; str[len-1 阅读全文
posted @ 2011-11-26 15:59 狸の舞 阅读(182) 评论(0) 推荐(0) 编辑