HDU 5347 MZL's chemistry

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  xy
 

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

查查元素周期表就ok了

#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=500005;
typedef long long ll;
ll T,a,b,f[100][3];
char s[2][100]={"FIRST BIGGER","SECOND BIGGER"};

int main()
{
    f[1][0]=1;    f[1][1]=1;
    f[2][0]=1;    f[2][1]=8;
    for (int i=3;i<=10;i++) { f[i][0]=2;    f[i][1]=i-2;}
    for (int i=11;i<=18;i++) {f[i][0]=3;    f[i][1]=i-10;} 
    f[35][0]=4;    f[35][1]=7;
    f[36][0]=4;    f[36][1]=8;    
    f[53][0]=5;    f[53][1]=7;
    f[54][0]=5;    f[54][1]=8;    
    f[85][0]=6;    f[85][1]=7;
    f[86][0]=6;    f[86][1]=8;
    while (~scanf("%lld%lld",&a,&b))
    {
        int flag=1;
        if (a>b) swap(a,b),flag^=1;
        if (f[a][1]==f[b][1]) flag=flag^(f[a][0]<f[b][0]?1:0);
        else 
        {
            if ((b==5||b==8||b==13||b==16)&&a==b-1) flag^=1;
        }
        puts(s[flag]);
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值