HDU 5347 MZL's chemistry(高三化学选修题)

本篇介绍了一种特殊算法来比较特定化学元素的第一电离能大小。这些元素包括周期表中的前18号元素及部分后续特定元素。通过特判的方式解决了当元素位于同一周期或同一族时的比较问题。

MZL's chemistry

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


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
 

Source
 
/* ************************************************************************/

题意:给你两个整型数x,y(xy)表示原子序数为集合{1,2,3,4,..18,35,36,53,54,85,86}中的一个所代表的元素,比较两元素第一电离能的大小,

若x代表的元素的第一电离能大,则输出FIRST BIGGER,否则输出SECOND BIGGER。

解题思路:高中化学学过第一电离能的孩子都知道这题该如何解,而且,出题人还降低了题目的难度,限制了x,y两元素要么是同一周期的,要么是统一族的,所以这题纯属是一道特判题,可能是学过忘了,但是不要紧,看两幅图就一切OK了。

同一周期中,唯一有点不同的地方是ⅡA族与ⅢA族之间的关系、ⅤA族与Ⅵ族之间的关系与其它同周期元素的关系是相反的


此题你也可以上网百度元素的第一电离能打个表什么的,但是我给的方法就是单纯的特判,判断是否是同一周期的,剩下的情况就是同一族的,见代码

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<queue>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<string>
#include<algorithm>
#include<iostream>
#define exp 1e-10
using namespace std;
const int N = 500005;
const int inf = 1000000000;
int main()
{
    int x,y;
    while(~scanf("%d%d",&x,&y))
    {
        if(x>0&&x<3&&y>0&&y<3)
            x>y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
        else if(x>2&&x<11&&y>2&&y<11)
        {
            if(x>3&&x<6&&y>3&&y<6)
                x<y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
            else if(x>6&&x<9&&y>6&&y<9)
                x<y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
            else
                x>y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
        }
        else if(x>10&&x<19&&y>10&&y<19)
        {
            if(x>11&&x<14&&y>11&&y<14)
                x<y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
            else if(x>14&&x<17&&y>14&&y<17)
                x<y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
            else
                x>y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
        }
        else if(x>34&&x<37&&y>34&&y<37||x>52&&x<55&&y>52&&y<55||x>84&&x<87&&y>84&&y<87)
            x>y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
        else
            x<y?puts("FIRST BIGGER"):puts("SECOND BIGGER");
    }
    return 0;
}

欢迎大家提建议

菜鸟成长记
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值