hdu 5344 MZL's xor (15多校第五场1002)
2015-08-05 20:40
274 查看
//多校第五场1002 //hdu 5344 //(Ai+Aj)^(Aj+Ai)=0 //sigma^(2*Ai); #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<vector> using namespace std; const long long mod=1e9+7; typedef long long LL; int main(){ int T; scanf("%d",&T); while(T--){ int n,m,l,z; scanf("%d%d%d%d",&n,&m,&z,&l); long long pre=0; LL tot=0; for(int i=2;i<=n;i++){ long long now=((LL)pre*m+z)%l; tot^=(2*now); pre=now; } printf("%lld\n",tot); } return 0; }
相关文章推荐
- C/C++语法知识精华整理(2)-栈与堆、内存四大区域、 全局变量、线程技术、位字段、函数返回值副本机制等
- ASP.NET运行机制
- 我的vim配置文件
- Spring 配置文件中如何配置数据库连接
- 算法设计与分析 - Week 3 分治策略
- appium Bootstrap UiSelectorParser源码分析
- 2015/8/5/抢锁/线程/JFrame
- 第二周周三
- 观察者模式、简单一对一双向聊天系统
- 枚举的简单应用(二)
- java工具类(三)之生成若干位随机数
- hdu1372(最爱的广搜)
- JavaScript基础----10Javascript语法-跳转语句----break和continue区别
- UIView详解
- Java中简单的生产者和消费者问题
- java工具类(三)之生成若干位随机数
- C语言:使用realloc函数对malloc或者calloc动态分配的内存大小进行扩展
- 200之内被7整除的数
- iOS之UIView的变更动画
- c#构造函数