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 ...
随机推荐
- Django 多个字段关联同一外键
# -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community b ...
- You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, i
[ERROR] Unknown lifecycle phase "mvn". You must specify a valid lifecycle phase or a goal ...
- CentOS 7中设置PHP7的Log文件日志
对于服务器上面运行的php代码, 想要去查看对应的log,找到代码无法运行的原因 1.通过:phpinfo()去找 error_log 结果得到: 2.然后去编辑php.ini,修改三处地方 vi / ...
- 解决Genymotion不能安装软件的问题
解决Genymotion不能安装软件的问题 官方取消了with google apps字样的rom,导致安装app不兼容的解决 有些童鞋在兴奋的打开Genymotion模拟器后可能会发现无法安装下载下 ...
- hashlib-sha摘要算法模块
摘要:hashlib: 摘要算法的模块 用处: 1.查看某两个文件是否完全一致 "abcdefggg" "abcdefhhg" 2.加密认证 把密码加密后写入文 ...
- TList实现的任务队列
TList实现的任务队列 var g_tasks: TList; type PTRecvPack = ^TRecvPack; TRecvPack = record // 接收到的原数据 socket: ...
- 蓦然回首,Java 已经 24 岁了!
01.蓦然 真没想到,Java 竟然 24 岁了(算是 90 后)! 提起 Java,印象最深刻的当然就是: class Cmower { public static void main(Strin ...
- FM算法及FFM算法
转自:http://tech.meituan.com/deep-understanding-of-ffm-principles-and-practices.html http://blog.csdn. ...
- 如何删除Windows 7的保留分区
Windows 7的保留分区可以删除,但是必须小心.启动到Windows 7,运行具有管理员权限的CMD.exe,然后输入:diskpartsel disk 0list volsel vol 0 (你 ...
- [React] PureComponent in React
In this lesson, you will learn how to use PureComponent in React to reduce the number of times your ...