poj 1493 Machined Surfaces
来源:互联网 发布:龙腾世纪3优化差 编辑:程序博客网 时间:2024/06/02 18:23
//读懂题意:将左边的字符串与右边的字符串进行合并,以最长的作为标准,问其余的合并时候剩余的空格! 题目中第一个例的合并之后的形式: //XXXX XXXXX//XXXXXXXXXX//XXXXX XXXX//XX XXXXXX//求中间剩余的空格数! #include <iostream>#include <string>#include <algorithm>using namespace std;string input[15];int c[15];int main(){ int n, i, j, max, ans; while (cin >> n) { cin.get(); if (n == 0) break; memset(c, 0, sizeof(c)); ans = 0; for (i = 0; i < n; i++) { getline(cin, input[i]); for (j = 0; j < input[i].length(); j++) if (input[i][j] == 'X') c[i]++; } sort(c, c+n); max = c[n-1]; for (i = 0; i < n; i++) ans += c[n-1]-c[i]; cout << ans << endl; } system("pause");}
- POJ 1493 Machined Surfaces
- poj 1493 Machined Surfaces
- poj 1493 Machined Surfaces
- POJ 1493 Machined Surfaces
- POJ 1493 Machined Surfaces
- POJ 1493 Machined Surfaces G++
- poj 1493 Machined Surfaces (基础题)
- POJ 1493 Machined Surfaces(水~)
- 1493 Machined Surfaces
- poj解题报告——poj 1493 Machined Surfaces
- poj 1493 Machined Surfaces(最后有多少个空格)
- Machined Surfaces
- Machined Surfaces
- Machined Surfaces
- Machined Surfaces
- Machined Surfaces
- Machined Surfaces
- Machined Surfaces
- cygwin syntax error near unexpected token `$'do\r''
- 谁贪占了我的系统资源 php-fpm
- Xcode4.2+SVN代码管理研究(一)
- Xcode4.2+SVN代码管理研究(二)
- 二维数组与new/delete
- poj 1493 Machined Surfaces
- 服务器×××上的MSDTC不可用解决办法
- 第十六周实验报告1
- MyEclipse提示键配置、提示快捷键、提示背景色、关键字颜色、代码显示、编...
- 顺序栈
- MAYA MEL 基础
- Cannot make a static reference to the non-static method xxx()
- MYSQL5.5修改字符集报错:unknown variable 'default-character-set=utf8'
- IE6 fixed的完美解决方案