解题思路是: Q=q1^q2.......^qn = p1^p2......^pn^((1%1)^....(1%n))^((2%1)^......(2%n))^.... 故Q的求解过程分成两部分 第一部分是求p1^p2......^pn 第二部分是求((1%1)^....(1%n))^((2%1)^......(2%n))^.... 将其化成矩形的形式 1%1   1%2  ...........  1%n 2%1   2%2  ............ 2%n ................…
题目 比赛的时候找出规律了,但是找的有点慢了,写代码的时候出了问题,也没交对,还掉分了.... 还是先总结一下位移或的性质吧: 1.  交换律 a ^ b = b ^ a 2. 结合律 (a^b) ^ c = a ^ (b^c) 3. 0^a = a; 4. a^a = 0;    a^a^a = a; 5.   知道a,b,c中任意两个就能推知第三个.      a^b = c 两边同时与a异或得: a ^ (a^b) = a^c 即 0^b = a^c  亦即 b = a^c 四个也是一样…
题目链接 A. Squats time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard output Pasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and eac…
CF424 A. Squats 题目意思: 有n(n为偶数)个x和X,求最少的变换次数,使得X的个数为n/2,输出变换后的序列. 解题思路: 统计X的个数ans,和n/2比較,少了的话,须要把n/2-ans个x变成X,多了的话须要把ans-n/2个X变成x.(从前往后扫一遍即可了). 代码: //#include<CSpreadSheet.h> #include<iostream> #include<cmath> #include<cstdio> #incl…
A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/problem/A Description Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the…
D. Magic Breeding link http://codeforces.com/contest/878/problem/D description Nikita and Sasha play a computer game where you have to breed some magical creatures. Initially, they have k creatures numbered from 1 to k. Creatures have n different cha…
D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single soluti…
题目链接: http://codeforces.com/contest/670/problem/D2 题解: 二分答案. #include<iostream> #include<cstdio> #include<cstring> #include<map> using namespace std; + ; const int INF = 2e9; typedef __int64 LL; int n, k; int x[maxn], y[maxn]; bool…
题目链接:http://codeforces.com/contest/424/problem/C, 想来一个小时,就是做不出,都做出来了,悲剧! 分析:我们知道交换异或的顺序不影响答案! 然后就是求t=a1^a2^a3^.....^an;这个直接做可以, q=(1%i)^(2%i)... ^(n^i);(1<=i<=n); //继续写完 当时我的想法是通过找规律,把1-n-1的个数都找出来,但是这个规律找不出. 后来知道有循环节这回事 比如:i=10的时候,循环节是1,2,3,4,..9,如果…
A. Magic Spheres   Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been seen before, he nee…