hdu5344 MZL's xor(水题)
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud
MZL's xor
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 488 Accepted Submission(s): 342
The xor of an array B is defined as B1 xor B2...xor Bn
Each test case contains four integers:n,m,z,l
A1=0,Ai=(Ai−1∗m+z) mod l
1≤m,z,l≤5∗105,n=5∗105
3 5 5 7
6 8 8 9
两个相同的数异或之后等于0,最终只剩下Ai+Ai的异或值
/**
* code generated by JHelper
* More info: https://github.com/AlexeyDmitriev/JHelper
* @author xyiyy @https://github.com/xyiyy
*/ #include <iostream>
#include <fstream> //#####################
//Author:fraud
//Blog: http://www.cnblogs.com/fraud/
//#####################
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <iostream>
#include <sstream>
#include <ios>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cctype> using namespace std;
#define rep(X, N) for(int X=0;X<N;X++)
typedef long long ll; class hdu5344 {
public:
void solve(std::istream &in, std::ostream &out) {
int t;
in >> t;
while (t--) {
ll m, z, l, n;
in >> n >> m >> z >> l;
ll x = ;
ll ans = ;
rep(i, n) {
ans ^= (x + x);
x = (x * m + z) % l;
}
out << ans << endl;
}
}
}; int main() {
std::ios::sync_with_stdio(false);
std::cin.tie();
hdu5344 solver;
std::istream &in(std::cin);
std::ostream &out(std::cout);
solver.solve(in, out);
return ;
}
hdu5344 MZL's xor(水题)的更多相关文章
- HDU 5344 MZL's xor (水题)
题意:给一个序列A,设序列B的中的元素有(Ai+Aj)(1≤i,j≤n),那么求B中所有元素的异或之和.而序列A是这样来的:A1=0,Ai=(Ai−1∗m+z) mod l. 思路:相同的元素异或结果 ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
随机推荐
- web移动开发的小细节(持续添加)
1.触屏设备上如何去掉数字转化为拨号链接的方法 <meta name=”format-detection” content=”telephone=no” /> telephone=no就禁 ...
- Python 多线程 队列 示例
Python3,开一个线程,间隔1秒把一个递增的数字写入队列,再开一个线程,从队列中取出数字并打印到终端 #! /usr/bin/env python3 import time import thre ...
- 命令行工具命令 - run包到手机里
命令行工具命令 你完全可以选择不输入以下这些命令,执行这些命令的结果与在 Android Studio 中单击"运行"按钮是一样的. chmod +x gradlew - 此命令只 ...
- AFNetworking 2.0 新特性讲解之AFHTTPSessionManager
AFNetworking 2.0 新特性讲解之AFHTTPSessionManager (2014-02-17 11:56:24) 转载▼ AFNetworking 2.0 相比1.0 API ...
- LeetCode_Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C wher ...
- ASP.NET WEB API回发到客户端消息体的格式化
首先基于SOA的消息通信基本都是按照一个统一的协议规范进行交互,那么必须定义消息体.不同的交互结构设计了不同的消息体. 业界统一使用的SOAP是一种规范的XML消息内容.例如在WCF中返回的结果. 随 ...
- elasticsearch 修改内存
[elk@zjtest7-redis bin]$ cat elasticsearch.in.sh if [ "x$ES_MIN_MEM" = "x" ]; th ...
- BZOJ1672: [Usaco2005 Dec]Cleaning Shifts 清理牛棚
1672: [Usaco2005 Dec]Cleaning Shifts 清理牛棚 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 414 Solved: ...
- Spring事务管理器分类
Spring并不直接管理事务,事实上,它是提供事务的多方选择.你能委托事务的职责给一个特定的平台实现,比如用JTA或者是别的持久机制.Spring的事务管理器可以用下表表示: 事务管理器的实例 目标 ...
- swift 弹窗
直接拷贝使用即可 let alert = UIAlertController(title:nil,message:"输入不能为空",preferredStyle: .Alert) ...