A == B ?

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 88211    Accepted Submission(s): 13922

Problem Description
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
 

本以为是一道水题,没想到处处坑点,被坑了一发。。

数组尽量开大一点,注意小数后无意义的0

AC代码:

 #include<iostream>
#include<cstdio>
#include<cstring>
using namespace std; const int MAX=;
char a[MAX]={},b[MAX]={}; int main(){ while(scanf("%s %s",&a,&b)!=EOF){
int i=;
if(strchr(a,'.')){//a中是否含小数点
for(i=strlen(a)-;a[i]=='';i--)
a[i]='\0';//消掉末尾的0
if(a[i]='.')
a[i]='\0';//消掉无意义的小数点
}
if(strchr(b,'.')){
for(i=strlen(b)-;b[i]=='';i--)
b[i]='\0';
if(b[i]='.')
b[i]='\0';
}
printf(strcmp(a,b)?"NO\n":"YES\n");//strcmp函数当a,b相等时返回值为0
}
return ;
}

HDOJ-2054的更多相关文章

  1. hdoj 2054(A==B)

    注意考虑以下数据: 123  123.0; 0.123  .123; 00.123  0.123; 代码: #include<iostream>#include<cstdio> ...

  2. 【HDOJ】2054 A == B ?

    这道题目起初看,so easy.再看一下ac率,注意到没有说明变量类型.显然是一道字符串的题.需要考虑+/-符号位,+.1.-.1.00010.0.+0.-00.00等情况,同时数组开到100000以 ...

  3. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  4. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  5. HDOJ 1326. Box of Bricks 纯水题

    Box of Bricks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

  6. HDOJ 1004 Let the Balloon Rise

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  7. hdoj 1385Minimum Transport Cost

    卧槽....最近刷的cf上有最短路,本来想拿这题复习一下.... 题意就是在输出最短路的情况下,经过每个节点会增加税收,另外要字典序输出,注意a到b和b到a的权值不同 然后就是处理字典序的问题,当松弛 ...

  8. HDOJ(2056)&HDOJ(1086)

    Rectangles    HDOJ(2056) http://acm.hdu.edu.cn/showproblem.php?pid=2056 题目描述:给2条线段,分别构成2个矩形,求2个矩形相交面 ...

  9. 继续node爬虫 — 百行代码自制自动AC机器人日解千题攻占HDOJ

    前言 不说话,先猛戳 Ranklist 看我排名. 这是用 node 自动刷题大概半天的 "战绩",本文就来为大家简单讲解下如何用 node 做一个 "自动AC机&quo ...

  10. 最近点对问题 POJ 3714 Raid && HDOJ 1007 Quoit Design

    题意:有n个点,问其中某一对点的距离最小是多少 分析:分治法解决问题:先按照x坐标排序,求解(left, mid)和(mid+1, right)范围的最小值,然后类似区间合并,分离mid左右的点也求最 ...

随机推荐

  1. 在Linux的Eclipse下搭建Android环境

    http://blog.csdn.net/lyonte/article/details/6407242 一.Java环境安装配置详见<在Linux下搭建Java环境>http://blog ...

  2. c# CacheManager 缓存管理

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  3. live555直播

    http://www.cppblog.com/tx7do/archive/2014/05/31/207155.aspx http://blog.csdn.net/sunkwei/article/det ...

  4. 【leetcode】Jump Game I, II 跳跃游戏一和二

    题目: Jump Game I: Given an array of non-negative integers, you are initially positioned at the first ...

  5. jvm -Xms -Xmx

    1 -Xms -X表示这是一个“-X”参数,m即memory,s即start,这个是jvm初始可以使用的整个堆的大小. 2 -Xmx x表示max,jvm最大可以使用的整个堆的大小. 3 oracle ...

  6. CMake命令笔记

    project 为整个工程设置名称.版本和启用语言 project(<PROJECT-NAME> [LANGUAGES] [<language-name>...])projec ...

  7. 编译性语言&amp;解释性语言

    计算机是不能理解高级语言.当然也就不能直接执行高级语言了.计算机仅仅能直接理解机器语言,所以不论什么语言,都必须将其翻译成机器语言.不论什么编程语言编写的程序归根究竟都是由底层机器的机器代码(01序列 ...

  8. (转)基于RTP的H264视频数据打包解包类

    最近考虑使用RTP替换原有的高清视频传输协议,遂上网查找有关H264视频RTP打包.解包的文档和代码.功夫不负有心人,找到不少有价值的文档和代码.参考这些资料,写了H264 RTP打包类.解包类,实现 ...

  9. pyinstaller-py2exe-cx_Freeze打包第一个wxPython程序HelloWorld

    pyinstaller 打包hello 7Mb ================= www.pyinstaller.org pip install pypiwin32 pip install pyin ...

  10. Automating hybrid apps

    Automating hybrid apps One of the core principles of Appium is that you shouldn’t have to change you ...