1410.cpp

来自「哈尔滨工业大学ACM 竞赛网上在线试题集锦的源代码」· C++ 代码 · 共 28 行

CPP
28
字号
/*  This Code is Submitted by wywcgs for Problem 1410 on 2006-01-12 at 03:24:51 */ 
#include <cstdio>
#include <algorithm>
using namespace std;

const int MAX = 32;

int main()
{
	char sur[MAX];
	int n, i, j;
	
	while(scanf("%d", &n) != EOF && n != 0) {
		getchar();
		int total = 0, m = MAX;
		for(i = 0; i < n; i++) {
			gets(sur);
			int space = 0;
			for(j = 0; sur[j] != 0; j++)
				if(sur[j] == ' ') space++;
			total += space; m = min(m, space);
		}
		printf("%d\n", total-m*n);
	}
	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?