UVa 12403 - Save Setu
题目:有两种操作:1.当前数值添加。2.输出当前数值。
分析:简单题。模拟就可以。
说明:A+B。
#include <iostream>
#include <cstdlib>
#include <string> using namespace std; string s; int main()
{
int n,sum,add;
while (cin >> n) {
sum = 0;
while (n --) {
cin >> s;
if (s[0] == 'd') {
cin >> add;
sum += add;
}else
cout << sum << endl;
}
}
return 0;
}
UVa 12403 - Save Setu的更多相关文章
- UVA - 11986 Save from Radiation
Description J Save from Radiation Most of you are aware of Nuclear Power Plant Explosion at Fukushim ...
- uva 10894 - Save Hridoy
#include <iostream> #include <string> #include <cstring> #include <cmath> us ...
- UVA 1291 十四 Dance Dance Revolution
Dance Dance Revolution Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Su ...
- UVA 322 ships (POJ 1138)
题目地址: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem ...
- UVA它11292 - Dragon of Loowater
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...
- UVA 257 - Palinwords(弦HASH)
UVA 257 - Palinwords 题目链接 题意:输出一个文本里面的palinword,palinword的定义为.包括两个不同的回文子串,而且要求回文子串不能互相包括 思路:对于每一个单词推 ...
- UVA 11292 Dragon of Loowater(简单贪心)
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance tur ...
- UVA 1341 - Different Digits(数论)
UVA 1341 - Different Digits 题目链接 题意:给定一个正整数n.求一个kn使得kn上用的数字最少.假设同样,则输出值最小的 思路: 首先利用鸽笼原理证明最多须要2个数字去组成 ...
- Risk UVA - 12264 拆点法+最大流+二分 最少流量的节点流量尽量多。
/** 题目:Risk UVA - 12264 链接:https://vjudge.net/problem/UVA-12264 题意:给n个点的无权无向图(n<=100),每个点有一个非负数ai ...
随机推荐
- 5.12-leepcode 作业详解
leepcode 作业详解 1.给定一个整数数组,判断是否存在重复元素.如果任何值在数组中出现至少两次,函数返回 true.如果数组中每个元素都不相同,则返回 false. 正确解答 class So ...
- 杭电 2647 Reward (拓扑排序反着排)
Description Dandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to ...
- static静态方法的优缺点
static可以修饰成员变量,成员方法,代码块,类特点: static修饰的方法和变量,为类所属方法和变量,不会在对象销毁时销毁,所以生命周期较长.被static修饰的内容会随着类的加载而加载,优先于 ...
- luogu3563 逛公园
两遍 spfa 然后建立分层图拓扑排序 dp 一下. 写得很差劲.效率很低. 时间复杂度 \(\mathrm{O}(Tnk)\). 参见这里秒懂. #include <iostream> ...
- 相应缓存设置HttpCacheability 枚举
成员名称 说明 NoCache 设置 Cache-Control: no-cache 标头.如果没有字段名,则指令应用于整个请求,且在满足请求前,共享(代理服务器)缓存必须对原始 Web 服务 ...
- [codeforces551E]GukiZ and GukiZiana
[codeforces551E]GukiZ and GukiZiana 试题描述 Professor GukiZ was playing with arrays again and accidenta ...
- zju 3209 dancing links 求取最小行数
题目可以将每一个格子都看做是一列,每一个矩形作为1行,将所有格子进行标号,在当前矩形中的格子对应行的标号为列,将这个点加入到十字链表中 最后用dlx求解精确覆盖即可,dance()过程中记得剪枝 #i ...
- 【随机化算法】codeforces Matrix God
http://codeforces.com/gym/101341 [题意] 给定三个方阵A,B,C,问AB=C是否成立? 方阵的规模最大为1000 [思路] 求AB的时间复杂度为n*n*n,会超时 左 ...
- Django学习之 - 基础部分
学习记录参考: 讲师博客:http://www.cnblogs.com/wupeiqi/articles/5433893.html 老男孩博客:http://oldboy.blog.51cto.com ...
- THUPC2017看题总结
THUPC2017 看题总结 #2402. 「THUPC 2017」天天爱射击 / Shooting 果题. 求当前子弹能会使多少块木板损坏,发现因为木板会随着子弹数目的增加而更加容易损坏,故此询问具 ...