codeforces 431 B Shower Line【暴力】】的更多相关文章

题意:给出五个人的编号,分别为 1 2 3 4 5,他们在排队, 最开始的时候,1和2可以交谈,3和4可以交谈 然后1走了之后,2和3交谈,4和5可以交谈 2走了之后,3和4可以交谈, 3走了之后,4和5可以交谈 给出一个5*5的矩阵,问最大的交谈的值, 比如2和3交谈,交谈的值为g[2][3]+g[3][2] 直接枚举排列,因为5!=120,算出每一种排列的交谈值,找出最大值 #include<iostream> #include<cstdio> #include<cstr…
[codeforces 549]G. Happy Line 试题描述 Do you like summer? Residents of Berland do. They especially love eating ice cream in the hot summer. So this summer day a large queue of n Berland residents lined up in front of the ice cream stall. We know that ea…
题目链接:http://codeforces.com/contest/431/problem/B 题目意思:给出5 * 5 的矩阵.从这个矩阵中选出合理的安排次序,使得happiness之和最大.当第i个人和第j个人talk 的时候,第i个人获得的happiness是g[i][j],第j 个人获得的happiness是g[j][i]. 好简单的一道题目,不知道昨晚徘徊好久都不敢打,五个for循环即可!数据量这么小......今天一次就过了... 谨以此来纪念自己的怯懦.... 方法一:直接暴力枚…
模拟即可 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ vector<); ; i < ; ++ i) a[i] = i; ][]; ; i < ; ++ i){ ; j < ; ++ j){ cin >> g[i][j]; } } ; do{ maxHappiness = max(g[a[]][a…
Hidden Code 题目连接: http://codeforces.com/gym/100015/attachments Description It's time to put your hacking skills to the test! You've been called upon to help crack enemy codes in the current war on... something or another. Anyway, the point is that yo…
A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Description King Triton really likes watching sport competitions on TV. But much more Triton likes watching live competitions. So Triton decides to set up…
G. #TheDress Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100637/problem/G Description After landing on planet i1c5l people noticed that blue and black clothes are quite popular among the locals. Each aboriginal has at least…
D. Jerry's Protest time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andr…
题目链接: http://codeforces.com/contest/651/problem/D D. Image Preview time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya's telephone contains n photos. Photo number 1 is currently opened on…
Winter is here at the North and the White Walkers are close. John Snow has an army consisting of n soldiers. While the rest of the world is fighting for the Iron Throne, he is going to get ready for the attack of the White Walkers. He has created a m…