UVALive 4853 Emoogle Balance
2015-10-04 20:10
375 查看
题意:题目很长,其实主要就是题中加粗的那个公式和输入输出。给n个数,用非零数的个数减去零的个数。
水题啦~
水题啦~
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int a[1005]; int main() { int ans, cnt = 1, n; while(~scanf("%d", &n)) { ans = 0; if(n == 0) break; int b; for(int i = 0; i < n; i++) { scanf("%d", &b); if(b == 0) ans--; else ans++; } printf("Case %d: %d\n", cnt++, ans); } }
相关文章推荐
- ASP.NET MVC + Bootstrap + XML + WCF 封装短信验证服务(一)
- AOP运行过程解析
- 第二次作业利用java语言编写计算器进行四则运算
- 自己的练习三之复制构造函数
- MFC Radio Button 和 Combox Button的简单操作
- 第三周学习总结
- [android]完美的解决方案ListView加载网络图片反弹问题
- 弱校联萌十一大决战之如日中天 G Gadget Hackwrench
- A018-布局之TableLayout
- 信息安全系统设计基础第四周学习总结
- 信息安全系统设计基础 第4周学习笔记
- Servlet的学习之Request请求对象(2)
- Java多态性理解
- main函数
- 线性筛
- 自己的练习二之构造函数与初始化列表
- 线性筛
- poj 1127 计算几何入门题 求线段交点
- Android Filter筛选ListView并且筛选内容变色
- HDOJ 5498 Tree