Codeforces 787B Not Afraid( 水 )】的更多相关文章

链接:传送门 题意:判断 m 组数,如果某一组中出现负数就判断这一组中是否存在与之相反的数,如果每一组中都满足要求则输出 "NO" 反之输出 "YES" 思路:对于任意的一组数,if v[i] < 0 则 vector.find( v.begin() , v.end() , -v[i] )查一下在这组数中是否出现过相反数,如果 find != v.end() 说明出现过,返回 true 否则返回一个 false /***********************…
CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <sstream> #include <set> #include <map> #include <queue>…
[题目链接]:http://codeforces.com/contest/787/problem/B [题意] -水题..题目太吓人 [题解] 只要你在一组里面找到两个数字,它们的绝对值相同,但是正负性相反,那么就可以确定,这一组 里面最少不会全是间谍. 知道这个之后只要贪心一下就好; 遇到一个组里面有互为相反数的,这个组就ok; 如果有一个组没有,就返回false; [完整代码] #include <bits/stdc++.h> using namespace std; #define ls…
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Halloween computer game. The game is played on a rectangular graveyard with a rectangular chapel in it. During the game, the player places new rectangul…
题目链接:http://codeforces.com/problemset/problem/705/A 从第三个输出中可看出规律, I hate that I love that I hate it I hate I love 是来回循环的,不到最后一个每一次循环后面都输出 that,如果到最后则输出 it #include<bits/stdc++.h> using namespace std; int main() { ][]= {"I love ","I ha…
题意:给定 n 个杯子,里面有不同体积的水,然后问你要把所有的杯子的水的体积都一样,至少要倒少多少个杯子. 析:既然最后都一样,那么先求平均数然后再数一下,哪个杯子的开始的体积就大于平均数,这是一定要倒的. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #inclu…
题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 1e5 + 5; const int INF = 0x3f3f3f3f; vector<int> ans;…
题意:对于给定的n个字符串,可以花费a[i]  将其倒序,问是否可以将其排成从大到小的字典序,且花费最小是多少. 析:很明显的水DP,如果不是水DP,我也不会做.... 这个就要二维,d[2][maxn],d[0][i]表示第 i 个不反转是最小花费,d[1][i]表示第 i 个反转最小花费,那么剩下的就很简单了么, 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio>…
Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86821#problem/I Description You are developing a new fashionable language that is not quite unlike C, C++, and Java. Since your langua…
A. Diplomas and Certificates time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n students who have taken part in an olympiad. Now it's time to award the students. Some of them will…