多校
来源:互联网 发布:新韩顺平php全套视频 编辑:程序博客网 时间:2024/05/21 01:51
MZL's xor
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 52 Accepted Submission(s): 42
Problem DescriptionMZL 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 ...xorBn
InputMultiple test cases, the first line contains an integer T(no more than 20), indicating the number of cases.
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
OutputFor every test.print the answer.
Sample Input23 5 5 76 8 8 9
Sample Output1416
思路:当i!=j时 一定存在Ai+Aj 与Aj+Ai 两数的大小相同,相等的两个数异或为0,0余任何数异或为任何数,所以只需要考虑当i==j时即可;
The xor of an array B is defined as
Each test case contains four integers:
23 5 5 76 8 8 9
1416
code:
#include<stdio.h>const int maxx=1000010;long long a[maxx];int main(){ __int64 cas,n,m,z,l,ans,i; scanf("%I64d",&cas); while(cas--) { scanf("%lld%lld%lld%lld",&n,&m,&z,&l); a[1]=ans=0; for(i=2;i<=n;i++) a[i]=(a[i-1]*m+z)%l; for(i=2;i<=n;i++) ans=ans^(2*a[i]); printf("%I64d\n",ans); }}
MZL's chemistry
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 36 Accepted Submission(s): 33
Problem DescriptionMZL define F(X) as the first ionization energy of the chemical element X
Now he get two chemical elements U,V ,given as their atomic number,he wants to compare F(U) and F(V)
It is guaranteed that atomic numbers belongs to the given set:{1,2,3,4,..18,35,36,53,54,85,86}
It is guaranteed the two atomic numbers is either in the same period or in the same group
It is guaranteed that x≠y
InputThere are several test cases
For each test case,there are two numbers u,v ,means the atomic numbers of the two element
OutputFor each test case,if F(u)>F(v) ,print "FIRST BIGGER",else print"SECOND BIGGER"
Sample Input1 25 3
Sample OutputSECOND BIGGERFIRST BIGGER
Now he get two chemical elements
It is guaranteed that atomic numbers belongs to the given set:
It is guaranteed the two atomic numbers is either in the same period or in the same group
It is guaranteed that
For each test case,there are two numbers
1 25 3
SECOND BIGGERFIRST BIGGER
code:
#include<bits/stdc++.h>using namespace std;int main(){ double a[100]; a[1]=1312.0;a[2]=2372.3; a[3]=520.2;a[4]=899.5;a[5]=800.6;a[6]=1086.6;a[7]=1402.3;a[8]=1313.9;a[9]=1681.0;a[10]=2080.7; a[11]=495.8;a[12]=737.7;a[13]=577.5;a[14]=786.5;a[15]=1011.8;a[16]=999.6;a[17]=1250.2;a[18]=1520.6; a[35]=1139.9;a[36]=1350.8; a[53]=1008.4;a[54]=1170.4; a[85]=890;a[86]=1037; int x,y; while(scanf("%d%d",&x,&y)!=EOF) { if(a[x]>a[y]) printf("FIRST BIGGER\n"); else printf("SECOND BIGGER\n"); } return 0;}
MZL's simple problem
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 129 Accepted Submission(s): 53
Problem Description
A simple problem
Problem Description
You have a multiple set,and now there are three kinds of operations:
1 x : add number x to set
2 : delete the minimum number (if the set is empty now,then ignore it)
3 : query the maximum number (if the set is empty now,the answer is 0)
Problem Description
You have a multiple set,and now there are three kinds of operations:
1 x : add number x to set
2 : delete the minimum number (if the set is empty now,then ignore it)
3 : query the maximum number (if the set is empty now,the answer is 0)
Input
The first line contains a number N (N≤106 ),representing the number of operations.
NextN line ,each line contains one or two numbers,describe one operation.
The number in this set is not greater than109 .
Next
The number in this set is not greater than
Output
For each operation 3,output a line representing the answer.
Sample Input
61 21 331 31 43
Sample Output
34
code:
#include<bits/stdc++.h>using namespace std;int main(){ int t,sum=0,Max=-1e9-7; scanf("%d",&t); while(t--) { // cout<<Max; int x,y; scanf("%d",&x); if(x==1) { scanf("%d",&y); Max=max(y,Max); sum++; } else if(x==2) { if(sum>0) sum--; if(sum==0) Max=-1e9; } else { if(sum==0) printf("0\n"); else printf("%d\n",Max); } } return 0;}
0 0
- 多校
- 多校
- 多校
- HDU4869 多校
- hdu5288 多校
- hdu5288 多校
- 多校3
- hdu 多校
- hdu 多校
- 多校 hdu
- 多校 hdu
- 多校 hdu
- HDU 多校
- 多校 9
- 多校 GCD
- 多校10
- 17 多校
- 17 多校
- Android实现水波纹外扩效果
- 浏览器上传文件到PHP的几种方法
- 设计模式 装饰者模式
- 颜色混合处理抗锯齿
- [LeetCode]Palindrome Linked List
- 多校
- android.support.v4.app.Fragment和android.app.Fragment区别
- 大讲台分享:关于MapReduce常见的问题及解决方案
- activiti入门3排他网关,并行网管,包含网关,事件网关
- 警告: 现有列的 ANSI_PADDING 设置为 “off”。将以 ANSI_PADDING 为 “on” 的设置创建新列。
- Deep Learning
- 处理百万级以上的数据提高查询速度的方法
- POJ 2996-Help Me with the Game(模拟)
- android Looper Handler机制