hpu第六次周赛Problem F
Problem F
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 54 Accepted Submission(s) : 6
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
但是粗心的我,常常将IP地址写错,现在需要你用程序来判断。
Input
Output
Sample Input
192.168.100.16
Sample Output
YES
/*
1. '.'有且只能有3个
2. 每个数字应该:1~255(含边界)
3. 不能有特殊字符
*/
#include <stdio.h>
#include <string.h> int main()
{
char s[];
while(gets(s))
{
int i,j,sum=,count=,t=;
int len;
len=strlen(s);
for(i=;i<len;i++)
{
if((s[i]>=''&&s[i]<='')||s[i]=='.')
continue;
else
break;
}
if(i>=len)
{
sum=;
for(j=;j<len;j++)
{
if(s[j]!='.')
{
count++;
sum=sum*+(s[j]-'');
}
else
{
t++;
if((sum<=&&sum>=)&&(count>=&&count<=))
{sum=;count=;}
else
break;
}
}
if(j>=len&&t==&&(sum<=&&sum>=))
printf("YES\n");
else
printf("NO\n");
}
else
printf("NO\n");
}
return ;
}
hpu第六次周赛Problem F的更多相关文章
- 实验12:Problem F: 求平均年龄
Home Web Board ProblemSet Standing Status Statistics Problem F: 求平均年龄 Problem F: 求平均年龄 Time Limit: ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem F
Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roa ...
- Codeforces Gym 100500F Problem F. Door Lock 二分
Problem F. Door LockTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/at ...
- Codeforces Gym 100002 Problem F "Folding" 区间DP
Problem F "Folding" Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/ ...
- Codeforces Gym 100286F Problem F. Fibonacci System 数位DP
Problem F. Fibonacci SystemTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudg ...
- Problem F: Exponentiation
Problem F: ExponentiationTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 4 Solved: 2[Submit][Status][W ...
- Problem F: 合唱比赛开始了!
Problem F: 合唱比赛开始了! Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 440 Solved: 201[Submit][Status][ ...
- 几何入门合集 gym101968 problem F. Mirror + gym102082 Problem F Fair Chocolate-Cutting + gym101915 problem B. Ali and Wi-Fi
abstract: V const & a 加速 F. Mirror 题意 链接 问题: 有n个人在y=0的平面上(及xoz平面).z=0平面上有一面镜子(边平行于坐标轴).z=a平面上有q个 ...
- Problem F Plug It In!
题目链接:https://cn.vjudge.net/contest/245468#problem/F 大意:给你插座和电器的对应关系,有多个电器对应一个插座的情况,但是一个插座只能供一个电器使用,现 ...
随机推荐
- html5中不再支持的元素
html5中不再支持的元素:1.acronym(建议abbr) : 定义首字母缩写2.applet(建议object): 定义 applet3.basefont(使用css控制)4.big(使用css ...
- 【TIDB】1、TiDb简介
一 TiDb简介 TiDB 是 PingCAP 公司受 Google Spanner / F1 论文启发而设计的开源分布式 HTAP (Hybrid Transactional and Analyti ...
- 【洛谷3546_BZOJ2803】[POI2012]PRE-Prefixuffix(String Hash)
Problem: 洛谷3546 Analysis: I gave up and saw other's solution when I had nearly thought of the method ...
- Excel文件导入导出
/** * 导入Excel文件数据 * * @param file 将要导入的Excel文件 * @param fileCheckKeyWord 用于判断导入文件是否 ...
- Intent的调用
//Intent intent=new Intent();//intent.setClass(MainActivity.this, GPSService.class);//以上二条可以合并成如下一条 ...
- DB2使用收集
db2命令收集 创建带分区的表: create table table_name( )in table_space index in index_space partition by range(c ...
- Java 基础入门随笔(1) JavaSE版——java语言三种技术架构
1.java语言的三种技术架构: J2SE(java 2 Platform Standard Edition):标准版,是为开发普通桌面和商务应用程序提供的解决方案.该技术体系是其他两者的基础,可以完 ...
- Memcached 在Linux上的安装
1.安装libevent wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libeve ...
- CentOS安装Nodejs-v8.11.1
(1)到NodeJs官网(https://nodejs.org/en/download/),复制下载链接 (2)下载并解压 命令:wget https://nodejs.org/dist/v8.11. ...
- eclipse常用设置之项目分组查看
1.打开‘NaviNavigator’ 视图,windows-->show views->NaviNavigator; 2.在NaviNavigator视图下选择select workin ...