Codeforces 839B - Game of the Rows】的更多相关文章

血崩- - /* CodeForces 839B - Game of the Rows [ 贪心,分类讨论] | Codeforces Round #428 (Div. 2) 注意 2 7 2 2 2 2 2 2 2 这组- - */ #include <bits/stdc++.h> using namespace std; int n, n2, n4, a[105], k; bool solve() { n2 = 2*k; n4 = k; for (int i = 1; i <= n;…
839B - Game of the Rows 思路:先放4个的,然后再放2个的,最后再放1个的. 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define mem(a,b) memset((a),(b),sizeof(a)) ]; int main() { int n,k; cin>>n>>k; ; int c4=n; ;i<…
Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane to carry her army through the…
B. Game of the Rows time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to brin…
 Co-prime Array Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 660A Description You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In e…
http://codeforces.com/contest/839/problem/B [题意] 给定n组人,告诉每组人的人数,这些人要在飞机上坐座位 飞机上座位的分布看图可以知道,12  3456  78 要求任意两个相邻座位不能是不同组的人 问在满足约束的情况下能不能保证所有的人有座位 [思路] 首先先占用中间四连坐的,这时剩下cnt个四连坐的和2*n个两连坐的 然后先满足剩下的a[i]中一对一对的,这时要优先选用两连坐的 那么最后剩下的是一个一个单个坐的,这时cnt个四连坐的有x个坐了一对…
[Link]:http://codeforces.com/contest/839/problem/B [Description] 给你n排的如题目所示的位置; 同一排中(1,2) 算相邻; (3,4),(4,5),(5,6)算相邻,然后(7,8)算相邻; 这里的(x,y)表示某个人坐在x,另外一个人坐在y的话. 问你够不够安排k组的人; 使得相邻座位的人都是相同组的人; 是则输出YES-. [Solution] 中间的那4个位置; 是没办法用来放不同组的成对的. 也即 xxyy不能放在中间那4个…
E - Qwerty78 Trip Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice Gym 100947E Description standard input/output Announcement   Statements Qwerty78 is a well known programmer (He is a member of the I…
D. Phillip and Trains time limit per test: 1 second memory limit per test :256 megabytes input: standard input output :standard output The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is loca…
http://codeforces.com/gym/100405 D题 题在pdf里 codeforces.com/gym/100405/attachments/download/2331/20132014-acmicpc-northwestern-european-regional-contest-nwerc-13-en.pdf D - Diagrams & TableauxA Young diagram is an arrangement of boxes in rows and colum…