码迷,mamicode.com
首页 > 其他好文 > 详细

多校联合训练第五场总结

时间:2015-08-05 13:03:08      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:机智题

先把我们ac的几道简单题捋捋,剩下的题以后再搞

1002:http://acm.hdu.edu.cn/showproblem.php?pid=5344

题意:根据题中所给公式,求出a[n]数组,然后对所有的(A技术分享i技术分享技术分享+A技术分享j技术分享技术分享)(1i,jn技术分享)求异或

思路:根据疑惑的性质,相同得0,不同为1,0和其他数异或还是原数,故对于不同的i,j,都有对应j,i使得两个数相等,这样两个相同的数异或就得0,最后只剩这些数本身的二倍做异或

代码:

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cctype>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <fstream>
#define debug "output for debug\n"
#define pi (acos(-1.0))
#define eps (1e-8)
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
const int maxn = 10000005;
ll a[maxn];
int main()
{
    int t;
    int m,n,z,l;
    ll sum;

    scanf("%d",&t);
    while(t--)
    {
        sum=0;
        scanf("%d%d%d%d",&n,&m,&z,&l);
        a[0]=0;
        for(int i=1;i<n;i++)
        {
            a[i]=(a[i-1]*m+z)%l;
            sum^=(2*a[i]);
        }
        printf("%I64d\n",sum);
    }
    return 0;
}


1005:http://acm.hdu.edu.cn/showproblem.php?pid=5347

题意:高中化学题,比较第一电离能

思路:百度到第一电离能,然后比较一下就行

代码:

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <ctime>
#include <ctype.h>
#define maxn 1000005
#define INF 12222
#define ll long long
using namespace std; 

int u,v;
int f[200]={0,1312,2372.3,520.2,932,800.6,1086.5,1402.3,1313.9,1681,2080.7,495.8,737.7,577.5,786.5,1011.8,999.6,1251.2,1520.6,
418.8,589.8,633.1,658.8,650.9,652.9,717.3,762.5,760.4,737.1,745.5,906.4,578.8,762,947,941,1139.9,1350.8,403,549.5,600,640.1,652.1,
684.3,702,710.2,719.7,804.4,731,867.8,558.3,708.6,834,869.3,1008.4,1170.4,375.7,502.9,538.1,534.4,527,533.1,540,544.5,547.1,593.4,
565.8,573,581,589.3,596.7,603.4,523.5,658.5,761,770,760,840,880,870,890.1,1007.1,589.4,715.6,703,812.1,890,1037,380,509.3,499,587
,568,597.6,604.5,584.7,578,581,601,608,619,627,635,642,470,580,};

int main()
{
    while(cin>>u>>v)
    {
        if(f[u]>f[v])
        {
            cout<<"FIRST BIGGER"<<endl;
        }
        if(f[u]<=f[v])
        {
            cout<<"SECOND BIGGER"<<endl;
        }
    }
    return 0;
}


 

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

题意:给你n个操作,1代表往里面加一个数字,2代表删除最小的数字,3代表找出最大的数字

思路:不用专门的set,直接维护最大值就好,如果只剩一个数字,删除后最大值就用负无穷来赋值

代码:

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cctype>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <fstream>
#define debug "output for debug\n"
#define pi (acos(-1.0))
#define eps (1e-8)
#define inf 0x3f3f3f3f
#define ll long long
using namespace std;
const int maxn = 100005;
int main()
{
    int t;
    int x;
    int a;
    int ma;
    int sum;
    sum=0;
    ma=-inf;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&x);
        if(x==1)
        {
           scanf("%d",&a);
           sum++;
           if(a>ma)
              ma=a;

        }
        else if(x==2)
        {
            if(sum==1)
            {
                ma=-inf;
            }
            if(sum==0)
                continue;
            sum--;
        }
        else
        {
            if(sum==0)
                printf("0\n");
            else
            printf("%d\n",ma);
        }
    }
    return 0;

}


 

剩下的以后再说、、、

 

版权声明:本文为博主原创文章,未经博主允许不得转载。

多校联合训练第五场总结

标签:机智题

原文地址:http://blog.csdn.net/li1004133206/article/details/47291979

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!