hdoj 5344 MZL's xor

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5344

 1     #include<stdio.h>
 2     #include<cstring>
 3     const int MAXN = 500010;
 4     int A[MAXN];
 5     void bas( int n, int m, int z, int l){
 6         for( int i = 1;i < n; ++i){
 7             A[i] = ( (long long)A[i-1]*m + z )% l;
 8         }
 9     }
10     void Cal(int n){
11         int sum = 0;
12         for( int i = 0;i < n; ++i){
13             sum = sum ^ (A[i]*2);
14         }
15         printf("%d\n",sum);
16     }
17     int main()
18     {
19         int n, m, z, l;
20         int T;
21         scanf("%d",&T);
22         while(T--){
23             memset(A,0,sizeof(A));
24             scanf("%d %d %d %d",&n,&m,&z,&l);
25             bas(n,m,z,l);
26             Cal(n);
27         }
28     }

hdoj 5344 MZL's xor

时间: 2024-11-06 04:35:00

hdoj 5344 MZL's xor的相关文章

hdu 5344 MZL&#39;s xor

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

hdu 5344 MZL&#39;s xor(数学之异或)

Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤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 inte

HDU 5344 MZL&#39;s xor (多校)[补7月28]

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

HDU 5344 MZL&#39;s xor(水题)

MZL's xor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 456    Accepted Submission(s): 322 Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to

hdu 5344 (多校联赛) MZL&#39;s xor --- 位运算

here:    首先看一下题吧:题意就是让你把一个序列里所有的(Ai+Aj) 的异或求出来.(1<=i,j<=n) Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤i,j≤n) The xor of an array B is defined as B1 xor B2...xor B

HDU 5344(2015多校5)-MZL&#39;s xor(水题)

题目地址:HDU 5344 题意:求所有(Ai+Aj)的异或值. 思路:可以发现(Ai+Aj)和(Aj+Ai)的异或值为0,所以最后只剩下(Ai+Ai). #include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <algorithm>

HDU 5344(MZL&amp;#39;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

HDU5344——数学题——MZL&#39;s xor

MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤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 20

HDOJ 5352 MZL&#39;s City 匈牙利匹配

求年份和城市的匹配 MZL's City Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 539    Accepted Submission(s): 180 Problem Description MZL is an active girl who has her own country. Her big country has N