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

HDU 5347

时间:2015-08-04 21:03:52      阅读:99      评论:0      收藏:0      [点我收藏+]

标签:acm算法

MZL‘s chemistry

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 164    Accepted Submission(s): 151


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


比较第一电离能的大小,B,Be,O,N,P,S特判一下就好。
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <map>
using namespace std;
int main()
{
    int a, b;
    while (scanf("%d%d", &a, &b) != EOF)
    {

        if ((a == 4 && b == 5) || (a == 5 && b == 4))
        {
            if (a>b)
            {
                cout << "SECOND BIGGER" << endl;
            }
            else
                cout << "FIRST BIGGER" << endl;
            continue;
        }
        if ((a == 7 && b == 8) || (a == 8 && b == 7))
        {
            if (a>b)
            {
                cout << "SECOND BIGGER" << endl;
            }
            else
                cout << "FIRST BIGGER" << endl;
            continue;
        }
        if ((a == 15 && b == 16) || (a == 16 && b == 15))
        {
            if (a>b)
            {
                cout << "SECOND BIGGER" << endl;
            }
            else
                cout << "FIRST BIGGER" << endl;
            continue;
        }
        if ((a == 1 && b == 3) || (a == 3 && b == 1))
        {
            if (a>b)
            {
                cout << "SECOND BIGGER" << endl;
            }
            else
                cout << "FIRST BIGGER" << endl;
            continue;
        }
        if ((a == 12 && b == 13) || (a == 13 && b == 12))
        {
            if (a>b)
            {
                cout << "SECOND BIGGER" << endl;
            }
            else
                cout << "FIRST BIGGER" << endl;
            continue;
        }
        if ((a == 1 && b == 3) || (a == 3 && b == 1))
        {
            if (a>b)
            {
                cout << "SECOND BIGGER" << endl;
            }
            else
                cout << "FIRST BIGGER" << endl;
            continue;
        }
        if (a - b>=8 || b - a>=8)
        {
            if (a<b)
                cout << "FIRST BIGGER" << endl;
            else
                cout << "SECOND BIGGER" << endl;
        }
        else
        {
            if (a > b)
                cout << "FIRST BIGGER" << endl;
            else
                cout << "SECOND BIGGER" << endl;
        }
    }
    return 0;
}

 
 

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

HDU 5347

标签:acm算法

原文地址:http://blog.csdn.net/sky_miange/article/details/47281763

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