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

hdu 5059

时间:2014-11-12 12:05:59      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:io   ar   sp   on   2014   bs   amp   ef   as   

/*
 * @brief hdu 5059
 * @file 5059.c
 * @author xiyan
 * @CreatedTime 2014/11/12
 * @LastChanged 2014/11/12
 * @note
 *      type: string convert
 *
 *
 */


#include <stdio.h>
#include <string.h>

#define MAXN 110



char s[MAXN], t[MAXN];
int a, b, c;

int solve()
{
     if(1 != sscanf(s, "%d", &c)) return -1;

     sprintf(t, "%d", c);

     if(0 != strcmp(s, t))   return -1;

     return ( (c >= a && c <=b )? 0 : -1);
}


int main()
{
#ifdef DEBUG
    freopen("./in", "r", stdin);
    freopen("./out","w", stdout);
#endif
    
    while(gets(s)){
        scanf("%d%d", &a, &b);
        getchar();
        printf("%s\n", solve() ? "NO" : "YES");
    }
    return 0;
}


hdu 5059

标签:io   ar   sp   on   2014   bs   amp   ef   as   

原文地址:http://my.oschina.net/u/572632/blog/343456

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