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[…
Description J Save from Radiation Most of you are aware of Nuclear Power Plant Explosion at Fukushima after devastating earth quake and tsunami. Many people in Bangladesh were seen to be concerned with radiation. The message says: BBC Flash news: Jap…
#include <iostream> #include <string> #include <cstring> #include <cmath> using namespace std; int main(){ //initialize for positive number ][]; strcpy(h[], "*****..***..*...*.*****...*...*.*****.*****.***...*****.*...*")…
Dance Dance Revolution Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVA 1291 Mr. White, a fat man, now is crazy about a game named ``Dance, Dance, Revolution". But his dance skill is so poor that h…
题目地址: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=258 http://poj.org/problem?id=1138 题目描写叙述:  Ships  Probably everyone who ever attended school knows the game where two opposing players place…
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime breeding ground for geese. Due to the lack of predato…
UVA 257 - Palinwords 题目链接 题意:输出一个文本里面的palinword,palinword的定义为.包括两个不同的回文子串,而且要求回文子串不能互相包括 思路:对于每一个单词推断一次.因为不能互相包括.对于每一个位置.事实上就仅仅要找长度3和4的情况就可以,这样复杂度为O(n),至于推断反复的.就用hash就可以 代码: #include <cstdio> #include <cstring> char str[260]; int hash[555555],…
Problem C: The Dragon of Loowater Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime breeding ground for geese. Due to the lack of predato…
UVA 1341 - Different Digits 题目链接 题意:给定一个正整数n.求一个kn使得kn上用的数字最少.假设同样,则输出值最小的 思路: 首先利用鸽笼原理证明最多须要2个数字去组成 设一个数字k.组成k,kk,kkk,kkkk... %n之后余数必定在0 - (n - 1)之间,所以必定能选出两个余数相等的数字相减为0,这个数字就是由0和k组成的. 因此仅仅要考虑一个数字和两个数字的情况,去bfs.记忆化余数.由于余数反复必定形成周期了 代码: #include <stdio…
/** 题目:Risk UVA - 12264 链接:https://vjudge.net/problem/UVA-12264 题意:给n个点的无权无向图(n<=100),每个点有一个非负数ai. 若ai==0则此点归敌方所有,若ai>0则此点归你且上面有ai个属于你的士兵. 保证至少有一个属于你的点与敌方的点相邻.你可以让你的每个士兵最多移动一次 ,每次可以待在原地或者去到相邻的属于你的领地,但每个点至少要留1各士兵, 使得最薄弱的关口尽量坚固.关口是指与敌方点相邻的点,薄弱与坚固分别指兵少…