HDU 5344(2015多校5)-MZL's xor(水题)
来源:互联网 发布:万网域名证书 编辑:程序博客网 时间:2024/04/28 13:12
题目地址: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>#include <set>#include <queue>#include <stack>#include <map>using namespace std;typedef long long LL;const int inf=0x3f3f3f3f;const double pi= acos(-1.0);const double esp=1e-6;LL n,m,z,l,ans;LL a[500010];int main(){ int T; scanf("%d",&T); while(T--){ memset(a,0,sizeof(a)); scanf("%lld %lld %lld %lld",&n,&m,&z,&l); a[1]=0; ans=0; for(int i=2;i<=n;i++){ a[i]=(a[i-1]*m+z)%l; ans^=(a[i]*2); } printf("%d\n",ans); } return 0;}
0 0
- HDU 5344(2015多校5)-MZL's xor(水题)
- HDU 5344 MZL's xor(水题)
- HDU 5344 MZL's xor
- HDU 5344 MZL's xor
- hdu 5344 MZL's xor
- hdu 5344 MZL's xor
- HDU 5344 MZL's xor
- Hdu-5344 MZL's xor
- HDU 5344 MZL's xor
- 2015多校-MZL's xor
- HDU 5344 多校赛1002 MZL's xor
- hdu 5344 MZL's xor(水)
- Hdu 5344 MZL's xor (杂)
- 【HDU 5344 MZL's xor】+ 异或
- [多校]MZL's xor
- HDU--5344--2015 Multi-University Training Contest 5--MZL's xor
- hdu 5334 MZL's xor
- hdu 5344 (多校联赛) MZL's xor --- 位运算
- 南邮 OJ 1157 C - 红宝书
- Kotlin基础语法
- finished with non-zero exit value 42
- 动态规划_DAG例题_The Tower of Babylon(UVA437)
- XIB或者storyboard中嵌入自定义view(xib)的方法
- HDU 5344(2015多校5)-MZL's xor(水题)
- solr学习文档之增量更新索引
- 计算UITableViewCell高度
- Java IO【21】PrintWriter的学习
- Makefile经典教程(掌握这些足够)
- mac 下的word破解版 安装详细步骤
- IBM公司面试题
- 南邮 OJ 1160 繁杂的道路
- Java compiler level does not match解决方法