【codeforces 785A】Anton and Polyhedrons】的更多相关文章

[题目链接]:http://codeforces.com/contest/785 [题意] 给你各种形状的物体; 然后让你计算总的面数; [题解] 用map来记录各种物体本该有的面数; 读入各种物体; 然后累加各种物体的面数; 然后输出就好; [完整代码] #include <bits/stdc++.h> using namespace std; #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define LL l…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are n vertices in the tree, e…
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the…
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potio…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Recently Anton found a box with digits in his room. There are k2 digits 2, k3 digits 3, k5 digits 5 and k6 digits 6. Anton's favorite integers ar…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Anton likes to play chess, and so does his friend Danik. Once they have played n games in a row. For each game it's known who was the winner - An…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Anton loves transforming one permutation into another one by swapping elements for money, and Ira doesn't like paying for stupid games. Help them…
[题目链接]:http://codeforces.com/contest/508/problem/B [题意] 给你一个奇数; 让你交换一次数字; 使得这个数字变成偶数; 要求偶数要最大; [题解] 肯定是1..len-1里面的某个偶数和最后那个奇数交换; 先考虑交换之后数字变大的情况; 即a[i]< a[len] 这里a[i]%2==0 这时,顺序1..len-1枚举找这样的数字;->在高位变大这样最优 找到之后交换直接输出; 然后数字变小的情况; 则逆序len-1..1找这样的数字即a[i…
[题目链接]:http://codeforces.com/problemset/problem/785/E [题意] 给你一个初始序列1..n顺序 然后每次让你交换任意两个位置上面的数字; 让你实时输出q个操作,每个操作过后整个序列逆序对的个数; [题解] 分块法; 分成根号n个块. 每个块按照数字升序排; 然后再用一个a数组具体记录每个位置上的数字; 找逆序对的方式如下: 对于交换l,r 查找l+1..r-1当中比a[l]小的数字,比a[l]大的数字; 查找l+1..r-1当中比a[r]小-比…
[题目链接]:http://codeforces.com/contest/785/problem/D [题意] 给你一个长度为n的括号序列; 让你删掉若干个括号之后,整个序列变成前x个括号为左括号,后x个括号为右括号; 问你有多少种删除方法. [题解] 先考虑一个简单的问题 对于一个括号序列,如果前x个括号都是左括号,后y个括号都是右括号; ((()))) 那么这个序列的RSBS的个数为C(X+Y,X) 即相当于构造一个长度为x+y的序列,包含x个1,y个0 如上述括号序列 这里即构造一个长度为…