您的位置:首页 > 其它

2015--多校训练第5场 1002 1005 1007

2015-08-04 18:52 316 查看

MZL's simple problem

Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 189 Accepted Submission(s): 80



[align=left]Problem Description[/align]
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)

[align=left]Input[/align]
The first line contains a number
N
(N≤106),representing
the number of operations.

Next N
line ,each line contains one or two numbers,describe one operation.

The number in this set is not greater than 109.

[align=left]Output[/align]
For each operation 3,output a line representing the answer.

[align=left]Sample Input[/align]

6
1 2
1 3
3
1 3
1 4
3


[align=left]Sample Output[/align]

3
4


[align=left]Source[/align]
2015 Multi-University Training Contest 5

解题思路:STL set直接模拟来搞,1A.

#include<deque>
#include<set>
#include<iostream>
#include<cstdio>
using namespace std;

struct classCompare
{
bool operator()(const int& lhs, const int& rhs)
{
return lhs < rhs ;
}

};

multiset<int,classCompare> myset;
multiset<int,classCompare>::iterator list;

int main()
{
int m;
int i;
int num1,num2;
while(scanf("%d",&m) != EOF)
{
myset.clear();
for(i=0;i<m;i++)
{
scanf("%d",&num1);
if(num1 == 1) //插入
{
scanf("%d",&num2);
myset.insert(num2);
}
else if(num1 == 2) //删除
{
if(!myset.empty())
{
list = myset.begin();
//printf("%d\n",*list);
myset.erase(list);
}
}
else if(num1 == 3) //询问
{
if(!myset.empty())
{

list = myset.end();
//printf("%d\n",*list);
list--;
printf("%d\n",*list);
}
else
{
printf("0\n");
}
}
}
}
}


MZL's chemistry

Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 0 Accepted Submission(s): 0



Problem Description

MZL 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


Input

There are several test cases

For each test case,there are two numbers u,v,means the atomic numbers of the two element


Output

For each test case,if F(u)>F(v),print "FIRST BIGGER",else print"SECOND BIGGER"


Sample Input

1 2
5 3


Sample Output

SECOND BIGGER
FIRST BIGGER


解题思路:
直接把元素的第一电离能存到数组里面,然后比较输出即可。

#include<cstdio>
#include<iostream>
#include<sstream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<functional>
#include<cctype>
#include<ctime>
#include<stack>
#include<queue>
#include<deque>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
int a,b;
float q[100];
int main()
{
q[1]=1312.0;
q[2]=2372.3;
q[3]=520.2;
q[4]=899.5;
q[5]=800.6;
q[6]=1086.5;
q[7]=1402.3;
q[8]=1313.9;
q[9]=1681.0;
q[10]=2080.7;
q[11]=495.8;
q[12]=737.7;
q[13]=577.5;
q[14]=786.5;
q[15]=1011.8;
q[16]=999.6;
q[17]=1251.2;
q[18]=1520.6;
q[35]=1139.9;
q[36]=1350.8;
q[53]=1008.4;
q[54]=1170.4;
q[85]=890.0;
q[86]=1037.0;
while(scanf("%d%d",&a,&b)!=EOF)
{
if(q[a]<q)
{
cout<<"SECOND BIGGER"<<endl;
}
else
{
cout<<"FIRST BIGGER"<<endl;
}
}
return 0;
}


MZL's xor

[b]Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 0 Accepted Submission(s): 0



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 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


Output

For every test.print the answer.


Sample Input

2
3 5 5 7
6 8 8 9


Sample Output

14
16


#include<stdio.h>
#define M 1000001
long long a[M];
int main()
{
long long  t,n,m,z,l,sum;
scanf("%lld",&t);
while(t--)
{
sum=0;
scanf("%lld%lld%lld%lld",&n,&m,&z,&l);
a[1]=0;
for(int i=2;i<=n;i++)
a[i]=(a[i-1]*m+z)%l;
for(int i=2;i<=n;i++)
sum^=2*a[i];
printf("%lld\n",sum);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: