#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分
0 人评分
【绝对值排序】 (C语言代码)浏览:695 |
简单的a+b (C++语言代码)浏览:837 |
大神老白 (C语言代码)浏览:612 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:567 |
C语言程序设计教程(第三版)课后习题6.10 (C语言代码)浏览:1036 |
C语言程序设计教程(第三版)课后习题8.1 (C语言代码)浏览:1225 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:834 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:563 |
1128题解(返回值为数组的情况)浏览:447 |
Tom数 (C语言代码)浏览:490 |