Clam Wei Network--Simple judgment IP

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.