标签:算法
#include <cstdio> #include <iostream> using namespace std; #ifdef ONLINE_JUDGE #define FINPUT(file) 0 #define FOUTPUT(file) 0 #else #define FINPUT(file) freopen(file,"r",stdin) #define FOUTPUT(file) freopen(file,"w",stdout) #endif int main() { FINPUT("in.txt"); FOUTPUT("out.txt"); int n; while(cin>>n && n) { for (int i = 0; i < n; ++i) { int p1,p2,p3,p4; char c; cin>>p1>>c>>p2>>c>>p3>>c>>p4; if(p1>=0&&p1<=255&&p2>=0&&p2<=255&&p3>=0&&p3<=255&&p4>=0&&p4<=255) cout<<"Yes!"<<endl; else cout<<"No!"<<endl; } } return 0; }
标签:算法
原文地址:http://blog.csdn.net/daringpig/article/details/25550807