2015 Multi-University Training Contest 5

官方题解:2015 Multi-University Training Contest 5 solutions BY 绍兴一中



1002


HDU 5344:http://acm.hdu.edu.cn/showproblem.php?pid=5344
题意:给出一个长度为\(n\)递推数列\(A\),求出所有\((A_i+A_j),(1\leqslant i,j\leqslant n)\)相异或的结果。



注意\(i,j\)之间没有关系限制,也就是说可以\(i==j\)
因为\((A_i+A_j) xor (A_j+A_i)==0\)

所以就只用计算所有\((A_i+A_i) \)相异或的值


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<string>
using namespace std;
#define MAX(a,b) ((a>b)?(a):(b))
#define MIN(a,b) ((a<b)?(a):(b))
#define LL __int64
#define N 500005
#define INF 1<<30

LL a[N];

int main(){
	int T;
	scanf("%d",&T);
	LL n,m,z,l;
	while(T--){
        cin>>n>>m>>z>>l;
        a[1]=0;
        LL ans=0;
        for(int i=2;i<=n;++i){
            a[i]=(a[i-1]*m+z)%l;
            ans^=(a[i]*2);
        }
        cout<<ans<<endl;
	}
	return 0;
}



1005


HDU 5347:http://acm.hdu.edu.cn/showproblem.php?pid=5347
题意:定义\(F(x)\)为原子系数为x的化学元素的第一电离能,给出\(u,v\),比较\(F(u),F(v)\)的大小。



直接打表。



#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<string>
using namespace std;
#define MAX(a,b) ((a>b)?(a):(b))
#define MIN(a,b) ((a<b)?(a):(b))
#define LL __int64
#define N 105
#define INF 1<<30


double f[N]={0,1312.0,2372.3,520.2,899.5,800.6,1086.5,1402.3,1313.9,1681.0,2080.7,495.8,737.7,577.5,786.5,1011.8,999.6,1251.2,1520.6};


int main(){
    f[35]=1139.9;
    f[36]=1350.8;
    f[53]=1008.4;
    f[54]=1170.4;
    f[85]=850.0;
    f[86]=1037.0;


	int u,v;
	while(~scanf("%d%d",&u,&v)){
        printf("%s\n",(f[u]>f[v]?"FIRST BIGGER":"SECOND BIGGER"));
	}
	return 0;
}



1007


HDU 5349:http://acm.hdu.edu.cn/showproblem.php?pid=5349

题意:给出一个multiset和三种操作:

1 x : 将数 \(x\) 加入集合中

2 : 删除一个集合中最小的数 (如果集合为空,忽略此操作)

3 : 询问集合中最大的数是多少 (如果集合为空,最大值为0)


直接用multiset可水过


#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<map>
#include<set>
using namespace std;
#define MAX(a,b) a>b?a:b
#define MIN(a,b) a<b?a:b
#define N 100005
#define INF 1<<30

int main()
{

    int n;
    multiset<int> s;
    multiset<int> ::iterator it;
    int op,x;
    while(scanf("%d",&n)!=EOF){
        while(n--){
            scanf("%d",&op);
            if(op==1){
                scanf("%d",&x);
                s.insert(x);
            }
            else if(op==2){
                if(!s.empty())
                    s.erase(s.begin());
            }
            else{
                if(!s.empty()){
                    it=--s.end();
                    printf("%d\n",(*it));
                }
                else{
                    puts("0");
                }
            }
        }
    }
    return 0;
}



(待续。。。)



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值