您的位置:首页 > 其它

HDU2054

2018-04-11 14:00 225 查看
本文章仅用于笔记。部分知识点来源于网络,授权请联系作者(1091879478@qq.com)。

题目

A == B ? HDU - 2054

Give you two numbers A and B, if A is equal to B, you should print “YES”, or print “NO”.

Input

each test case contains two numbers A and B.

Output

for each case, if A is equal to B, you should print “YES”, or print “NO”.

Sample Input

1 2

2 2

3 3

4 3

Sample Output

NO

YES

YES

NO

代码

//AC版
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
while (s.hasNextBigDecimal())
{
BigDecimal a=s.nextBigDecimal();
BigDecimal b=s.nextBigDecimal();
if (a.compareTo(b)==0)
System.out.println("YES");
else
System.out.println("NO");
}
}
//WA版
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
while (s.hasNext())
{
String a=s.next();
String b=s.next();
if (a.equals(b))
System.out.println("YES");
else
System.out.println("NO");
}
}
//WA版中 01 1 输出NO
//AC版中 01 1 输出YES
//需要的是数字而不是字符串
//用String的equals不够规范
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  numbers