12 2013 档案
摘要:关于将读入的数据分别计算每一位的和int SumOfNum(int a){ int sum = 0; while (a >= 10) { sum += a % 10; a = a / 10; } sum += a; return sum;}
阅读全文
摘要:1018http://acm.hdu.edu.cn/showproblem.php?pid=1018在其中要体现一下几个问题:一、一个整数的位数计算二、优化算法设有一个整数n,且10x-1≤n#include #includeint main(){ int n,i,num; double sum,j; scanf_s("%d", &n); for ( i = 0; i #include #include#define PI 3.1415926535898#define E 2.71828182845904523536028747135266250int main(.
阅读全文
摘要:题目:http://acm.hdu.edu.cn/showproblem.php?pid=1017#include int main(){ int N,n,m,a,b,count=0,Case; scanf("%d", &N); while (N--) { int Case = 1; while (scanf("%d %d",&n,&m)!=EOF) { if (n == 0 && m == 0) { break; } ...
阅读全文
摘要:#include #include int main(){ int num, i, k, j, max, times; char **array; char maxColor[21]; while (scanf("%d", &num) != EOF && num != 0) { getchar(); array = (char **)malloc(sizeof(char*)*num); for (i = 0; i max) { max = times; ...
阅读全文
摘要:#include #include #include using namespace std;int main(int aegv, char argv[]){ map colormap; int num; while (cin >> num && num) { colormap.clear(); string color; for (int i = 0; i > color; colormap[color]++; } int max = 0; string maxC...
阅读全文
摘要:scanf_s("%d", &n); for (j = 0; jint main(){char str[80];char str1[80];char str2[80];scanf("%s",str);/*此处输入:I love you! */printf("%s",str);sleep(5);/*这里等待5秒,告诉你程序运行到什么地方*/scanf("%s",str1);/*这两句无需你再输入,是对键盘盘缓冲区再扫描 */scanf("%s",str2);/*这两句无需你再输入,是对键盘
阅读全文
摘要:输入:一、输入不说明有多少个Input Block,以EOF为结束标志。The input will consist of a series of pairs of integers a and b, separated by a space, one pair of integers per line.C语言中,EOF常被作为文件结束的标志。还有很多文件处理函数处错误后的返回值也是EOF,因此常被用来判断调用一个函数是否成功。(如:while (scanf("%d",&n),n!=EOF) //while(scanf("%d",&n)!
阅读全文