uva414 - Machined Surfaces
/*
水题,值得一提的是,getline使用时注意不能让它多吃回车键,处理方法可以用getchar。
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int n; while (cin >> n, n)
{
getchar(); //第一个回车键会被getline拿去,所以要用getchar处理这个回车 定义在cstdio string s[n]; int black[n], sum = ; for (int i = ; i < n; ++i)
{
getline(cin, s[i]); int temp = ; for (int j = ; j < s[i].size(); ++j)
{
if (s[i][j] == 'X')
temp--;
} black[i] = temp; sum += black[i];
} cout << sum - *min_element(black, black+n)*n << endl;
}
}
uva414 - Machined Surfaces的更多相关文章
- UVa 414 - Machined Surfaces
https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...
- 414 - Machined Surfaces
Sample Input (character "B" for ease of reading. The actual input file will use the ASCII- ...
- UVA_414:Machined Surfaces
Language : C++ 4.8.2 #include<stdio.h> #include<string.h> int main(void) { int n; int su ...
- UVA题目分类
题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...
- 【索引】Volume 0. Getting Started
AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...
- POJ题目细究
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP: 1011 NTA 简单题 1013 Great Equipment 简单题 102 ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- <<Differential Geometry of Curves and Surfaces>>笔记
<Differential Geometry of Curves and Surfaces> by Manfredo P. do Carmo real line Rinterval I== ...
随机推荐
- App开发架构指南(谷歌官方文档译文)
这篇文章面向的是已经掌握app开发基本知识,想知道如何开发健壮app的读者. 注:本指南假设读者对 Android Framework 已经很熟悉.如果你还是app开发的新手,请查看 Getting ...
- 操作系统开发之——一个简单的Bootsect
先吓唬一下读者朋友呵呵,直接发代码:(这是UOS操作系统的Bootsect)(有兴趣的朋友能够增加我们,联系方式在最后) ;------------------------------ ;文件名称:B ...
- macOS中安装docker
如官方文档中所说: 1.点击进入boot2docker/osx-installer release页面. 2.在下载页面中点击 Boot2Docker-x.x.x.pkg 来下载 Boot2Docke ...
- swift中的nil与Objective-C中的nil区别
1.OC中,只有对象才能设置为nil,而swift中除了对象,Int.struct.enum等任何可选类型都可以等于nil 2.OC中,nil是一个指向不存在对象的指针.swift中,nil不是指针, ...
- GSM/GPRS/EDGE简介
GSM 全球移动通信系统(Global System of Mobile communication),是全球应用最广泛的移动电话标准.GSM被认为是第二代移动通信标准(2G),同时它是一个开放的标准 ...
- host文件配置 了解
https://blog.csdn.net/CJF_iceKing/article/details/7702694 hosts文件位于" C:\Windows\System32\driver ...
- php学记笔记之函数用途
echo '<pre>';//格式化输出字符 isset();//判断变量是否存在 array_key_exists('key',$arr);//判断数组下标是否存在 in_array(' ...
- 区分SQL Server关联查询之inner join,left join, right join, full outer join并图解
1.from A inner join B on A.ID=B.ID :两表都有的记录才列出 A表: ID Name B表: ID Clas ...
- [svc]linux常用手头命令-md版-2017年11月12日 12:31:56
相关代码 curl命令-网站如果3次不是200或301则报警 curl -o /dev/null -s -w "%{http_code}" baidu.com -k/--insec ...
- Android开发-状态栏着色原理和API版本号兼容处理
介绍 先上实际效果图,有三个版本号请注意区分API版本号 API>=20 API=19 API<19 watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZX ...