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的更多相关文章

  1. UVa 414 - Machined Surfaces

    https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=94&page=s ...

  2. 414 - Machined Surfaces

    Sample Input (character "B" for ease of reading. The actual input file will use the ASCII- ...

  3. UVA_414:Machined Surfaces

    Language : C++ 4.8.2 #include<stdio.h> #include<string.h> int main(void) { int n; int su ...

  4. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  5. 【索引】Volume 0. Getting Started

    AOAPC I: Beginning Algorithm Contests (Rujia Liu) Volume 0. Getting Started 10055 - Hashmat the Brav ...

  6. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  7. HOJ题目分类

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

  8. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  9. <<Differential Geometry of Curves and Surfaces>>笔记

    <Differential Geometry of Curves and Surfaces> by Manfredo P. do Carmo real line Rinterval I== ...

随机推荐

  1. org.w3c.dom(java dom)解析XML文档

    位于org.w3c.dom操作XML会比较简单,就是将XML看做是一颗树,DOM就是对这颗树的一个数据结构的描述,但对大型XML文件效果可能会不理想 首先来了解点Java DOM 的 API:1.解析 ...

  2. 算法笔记_165:算法提高 道路和航路(Java)

    目录 1 问题描述 2解决方案   1 问题描述 问题描述 农夫约翰正在针对一个新区域的牛奶配送合同进行研究.他打算分发牛奶到T个城镇(标号为1..T),这些城镇通过R条标号为(1..R)的道路和P条 ...

  3. vfork & fork

    转载 http://coolshell.cn/articles/12103.html 在知乎上,有个人问了这样的一个问题——为什么vfork的子进程里用return,整个程序会挂掉,而且exit()不 ...

  4. Centos 6.4 python 2.6 升级到 2.7一起的MySQLdb不能使用的解决问题

    查看python的版本#python -V Python 2.6.6 1.下载Python-2.7.3#wget http://python.org/ftp/python/2.7.3/Python-2 ...

  5. Nginx视频流模块nginx-rtmp-module

    文章参考地址:https://www.cnblogs.com/tinywan/p/6202345.html nginx-rtmp-module:https://github.com/arut/ngin ...

  6. Mutex 进程间互斥

    学习Mutex的心得,不一定对,先记录一下. 同步技术分为两大类,锁定和信号同步. 锁定分为:Lock.Monitor 信号同步分为:AutoResetEvent.ManualResetEvent.S ...

  7. ASP.NET前后台交互之JSON数据

    最近由于项目需要做一个Ajax的搜集单表单的多重数据的需求,所以就采用了前端JQuery保存Object对象之后转换成JSON的数据源传递给后台处理的这样的形式,相信有不少人大多时候是接收后台给出的J ...

  8. Atitit.atiJsBridge 新特性v7q329

    Atitit.atiJsBridge 新特性v7q329 atiJsBridge 未来计划 Postdata  图像上传的支持 Simp param计划 p1 p2 p3 p4 $method 的si ...

  9. 代码覆盖率?coverage

    http://www.infoq.com/cn/articles/test-coverage-rate-role 代码覆盖率?coverage   http://www.cnblogs.com/cod ...

  10. iOS开发之使用XMPPFramework实现即时通信

    iOS开发之使用XMPPFramework实现即时通信   关于XMPP的理论介绍在本篇博客中就不做赘述了,如何在我们之前的微信中加入XMPP协议来实现通信呢?下面将会介绍一下XMPP的基本的知识,让 ...