#include<cstdio> #include<iostream> #include<string> #include<cstring> #include<sstream> using namespace std; int fac(int x) { return x>=0 && x<=255; } int main(void) { string line ; while(getline(cin , line)) { char str[100] ,ch , *p=str; int a, b , c ,d , flag = 1; strcpy(str,line.c_str()); while(*p){ if( isalpha(*p) || *p=='-'){ flag = 0 ;break;} p++;} if(flag){ flag = 0 ; stringstream ss(line); ss >> a >> ch>> b>> ch>>c >> ch>> d; if(fac(a) && fac(b) && fac(c) && fac(d)) flag=1; } if(flag) printf("Y\n"); else printf("N\n"); } return 0 ; }
解题思路:
注意事项:
参考代码:
0.0分
1 人评分
你的开发任务 (C++代码)写到一半,等有心情回来补全浏览:879 |
十->二进制转换 (C++代码)(零和负数需要特殊处理)浏览:1040 |
点我有惊喜!你懂得!浏览:1060 |
C二级辅导-阶乘数列 (C语言代码)浏览:612 |
C语言程序设计教程(第三版)课后习题8.4 (Java代码)浏览:728 |
C语言训练-字符串正反连接 (C语言代码)浏览:616 |
最小公倍数 (C语言代码)浏览:856 |
C语言程序设计教程(第三版)课后习题9.4 (C语言代码)浏览:664 |
Cylinder (C语言描述,蓝桥杯)浏览:1245 |
A+B for Input-Output Practice (VI) (C语言代码)浏览:552 |