HDU 2206 IP的计算 字符串
来源:互联网 发布:淘宝精仿 编辑:程序博客网 时间:2024/06/05 18:13
http://acm.hdu.edu.cn/showproblem.php?pid=2206
#include<iostream>#include<string>#include<cstring>#include<algorithm>#include<cstdio>#include<cmath>#include<cctype>#include<iomanip>using namespace std;const int inf=10000000;int main() { char f[105]; while(gets(f)!=NULL) { bool ok=true; int p[100],k=0; for(int i=0;f[i]&&ok;++i) if(f[i]=='.') p[k++]=i; else if(f[i]<'0'||f[i]>'9')ok=false; if(k!=3)ok=false;///不是三个'.' if(!p[0]||p[0]-0>3)ok=false;///两点之间超过三位 for(int i=1;i<k;++i)/// if(p[i]-p[i-1]>4||p[i]-p[i-1]==1)ok=false;/// int len=strlen(f); int s=0; for(int i=0;f[i];++i) if(f[i]=='.'){ if(s>255)ok=false; s=0; } else s=s*10+f[i]-'0'; if(s>255)ok=false; if(ok)puts("YES"); else puts("NO"); } return 0;}
- HDU 2206 IP的计算 字符串
- HDU 2206 IP的计算(字符串处理)
- HDU 2206 IP的计算(字符串处理)
- hdu 2206 IP的计算
- HDU 2206 - IP的计算
- hdu 2206 IP的计算
- hdu 2206 IP的计算
- HDU 2206 IP的计算
- hdu 2206 IP的计算
- hdu-2206-Ip的计算
- 2206 IP的计算 HDU
- hdu 2206 ip的计算
- HDU 2206 IP的计算
- hdu 2206IP的计算(sscanf的使用 & 字符串判断处理)
- hdu 2206 IP计算
- HDU 2206 IP的计算 WA
- HDU 2206 IP的计算 比较坑
- HDU--2206 -- IP的计算 [正则表达式]
- ubuntu学习系列
- hdu 2152 Fruit
- Android 页面滑动切换(类Launcher滑动屏幕实现)
- ARM嵌入式Linux系统构造与驱动认知
- 编译和链接的区别
- HDU 2206 IP的计算 字符串
- Apache Shiro 集成-Cas
- MATLAB2013a下载地址
- 浅谈C#堆栈与托管堆的工作方式
- magento 添加支付方式
- 什么是句柄??
- ubuntu备份与恢复
- 自己感兴趣的网站
- java编程之计算3000绳子每天剪一半,绳子短于5米需要时间