Heart tired, dog Day thought a lot of data, ... I'm going to cry for a while.
1#include <stdio.h>2#include <string.h>3#include <math.h>4#include <iostream>5#include <limits.h>6#include <algorithm>7#include <queue>8#include <vector>9#include <Set>Ten#include <stack> One#include <string> A#include <sstream> -#include <map> -#include <cctype> the using namespacestd; - //1, three points - //2. Determine if the number is within range - //3, the letter is not test instructions. + //4, up to three numbers - intMain () + { A intT; at Chara[ -]; -scanf"%d",&t); - while(t--) - { -scanf"%s", a); - intL=strlen (a), flag=1;//Default can in intsum=0, count1=0, time=0; - for(intI=0; i<l;i++) to { + if(a[i]=='.') - { the if(sum<0|| Sum>255) *flag=0; $ if(time==0|| Time>3)//determine whether the number of digits between two points meets the requirementsPanax Notoginsengflag=0; -time=sum=0; thecount1++; + Continue; A } the if(! (a[i]>='0'&&a[i]<='9'))//If it wasn't 0-9, +flag=0;//don't say anything about the letters .... -sum=sum*Ten+a[i]-'0'; $time++; $ } - if(count1!=3) -flag=0; the if(flag) -printf"yes\n");Wuyi Else theprintf"no\n"); - } Wu return 0; -}
Clam Wei Network--Simple judgment IP