HDU 5344(MZL's xor-(ai+aj)的异或和)】的更多相关文章

MZL's xor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 800    Accepted Submission(s): 518 Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to…
Problem Description   MZL loves xor very much.Now he gets an array A.The length of A ≤i,j≤n) The xor of an array B is defined as B1 xor B2...xor Bn Input Multiple test cases, the first line contains an integer T(no more than ), indicating the number…
MZL's xor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 911    Accepted Submission(s): 589 Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to k…
MZL's xor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 249    Accepted Submission(s): 187 Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to k…
题意:给一个序列A,设序列B的中的元素有(Ai+Aj)(1≤i,j≤n),那么求B中所有元素的异或之和.而序列A是这样来的:A1=0,Ai=(Ai−1∗m+z) mod l. 思路:相同的元素异或结果为0,所以可以去掉,也就是剩下A中的元素ai+ai那些而已. 小心乘法会溢出 #include <bits/stdc++.h> #define INF 0x7f7f7f7f #define pii pair<int,int> #define LL long long using nam…
MZL's chemistry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 629    Accepted Submission(s): 449 Problem Description MZL define F(X) as the first ionization energy of the chemical element X N…
给一个无向图(事实上是有向的.可是没有指定边的方向),你须要指定边的方向,使得每一个点入度和出度相差不超过1. 事实上就是找很多条路径.合起来能走完这个图..先统计各个顶点的度.度为奇数必是起点或终点,否则是中间点或者同为起点和终点. 邻接表建图(建双向),先从每一个奇数度顶点出发找路径,再从偶数度顶点出发找路径.经过的边要删去不然超时. #include <iostream> #include <cstring> #include <cstdio> #include…
[HDU 5351 MZL's Border]题意 定义字符串$f_1=b,f_2=a,f_i=f_{i-1}f_{i-2}$. 对$f_n$的长度为$m$的前缀$s$, 求最大的$k$满足$s[1]=s[m-k+1],s[2]=s[m-k+2]...s[k]=s[m]$ Solution 先列出前几个字符串 $f_3=ab,f_4=aba,f_5=abaab,f_6=abaababa,f_7=abaababaabaab$. 对于n,m. 假设$f_{n-1}$的长度大于等于$m$,那么相当于求…
B. Powers of Two   You are given n integers a1, a2, ..., an. Find the number of pairs of indexes i, j (i < j) that ai + aj is a power of 2 (i. e. some integer xexists so that ai + aj = 2x). Input The first line contains the single positive integer n …
#include<bits/stdc++.h> using namespace std; #define ll long long #define maxn 100010 /* 已知一个序列A1.A2….An,给你一个整数K,找到满足所有Ai+Aj>=k的数对(i,j)的个数 */ int main() { ],k,low,upp; while(cin >> n >> k){ , ans2 = ; ; i<n; i++) cin >> a[i];…