合法IP
来源:互联网 发布:腾讯管家域名检测 编辑:程序博客网 时间:2024/06/10 21:08
#include<iostream>#include<string>#include<stdlib.h>using namespace std;int main(){ string input; cin>>input; int k = 0; int location[4] = {0}; int flag = 1; for(int i = 0; i < input.length(); i++){ if(input[i] == '.') location[k++] = i; } if(k != 3){ cout<<"NO"<<endl; return 0; } int tmposition = 0; for(int i = 0; i < 3; i++){ int position = location[i]; string str = input.substr(tmposition, position - tmposition); int intIP = atoi(str.c_str()); if( intIP < 0 || intIP > 255){ cout<<"NO"<<endl; return 0; } tmposition = position + 1; } string str = input.substr(location[2]); int intIP = atoi(str.c_str()); if( intIP < 0 || intIP > 255){ cout<<"NO"<<endl; return 0; } cout<<"YES"<<endl; return 0;}
0 0
- 合法IP
- 合法IP
- 合法IP
- 合法IP
- 合法IP
- 合法IP
- 合法IP
- 判断IP合法
- 华为OJ ----合法IP
- 华为oj-合法IP
- 合法IP检测
- 合法ip序列
- 【华为oj】合法ip
- 华为oj 合法ip
- 华为oj 合法IP
- 【华为 OJ 】合法IP
- OJ-----合法IP*
- 【华为OJ】合法IP
- Codeforces 567C Geometric Progression
- ### Error querying database. Cause: org.postgresql.util.PSQLException: 大型对象无法被使用在自动确认事物交易模式。
- win10+Genymotion 出现“Unable to load virtualbox engine”错误解决方案
- 解决Qt中QLabel控件加载动态图出现黑色背景的问题
- 防火墙测试软件
- 合法IP
- 线程面试题
- ADSafe3.5.4.721超精简汇编修改启动无提示爽歪歪直接退出版
- configure配置及其cmake配置-静态库生成
- 《实体解析与信息质量》 - 3.1.3 Algebraic模型
- [Geo][Matlab]地理校正过后tiff图自动掩膜技巧
- Android中通过ViewHelper.setTranslationY实现View移动控制(NineOldAndroids开源项目)
- USACO 2012 December Contest, Bronze Problem 1. Meet and Greet (模拟)
- 利用正则表达式转换String 为int或Double