poj 2105 IP Address
Time Limit: 1000MS | Memory Limit: 30000K | |
Total Submissions: 18951 | Accepted: 10939 |
Description
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
128 64 32 16 8 4 2 1
Input
Output
Sample Input
4
00000000000000000000000000000000
00000011100000001111111111111111
11001011100001001110010110000000
01010000000100000000000000000001
Sample Output
0.0.0.0
3.128.255.255
203.132.229.128
80.16.0.1
Source
#include <cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
using namespace std;
int b[]={,,,,,,,};
int main(){
int n;
string s;
while(cin>>n){
while(n--){
cin>>s;
int i,j,k=;
for(i=;i<=;){
int sum=;
j=;
while(j<){
if(s[i]=='')
sum+=b[i%];
i++;
j++;
}
cout<<sum;
if(k<){
cout<<'.';
}
else{
cout<<endl;
}
k++;
}
}
}
return ;
}
poj 2105 IP Address的更多相关文章
- OpenJudge/Poj 2105 IP Address
1.链接地址: http://poj.org/problem?id=2105 http://bailian.openjudge.cn/practice/2105 2.题目: IP Address Ti ...
- poj 2105 IP Address(水题)
一.Description Suppose you are reading byte streams from any device, representing IP addresses. Your ...
- IP Address 分类: POJ 2015-06-12 19:34 12人阅读 评论(0) 收藏
IP Address Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 19125 Accepted: 11053 Desc ...
- poj2105 IP Address(简单题)
题目链接:id=2105">http://poj.org/problem?id=2105 ----------------------------------------------- ...
- ERROR 2003 (HY000): Can't connect to MySQL server on 'ip address' (111)的处理办法
远程连接mysql数据库时可以使用以下指令 mysql -h 192.168.1.104 -u root -p 如果是初次安装mysql,需要将所有/etc/mysql/内的所有配置文件的bind-a ...
- oracle 11g RAC安装节点二执行结果错误CRS-5005: IP Address: 192.168.1.24 is already in use in the network
[root@testdb11b ~]# /u01/app/oraInventory/orainstRoot.sh Changing permissions of /u01/app/oraInvento ...
- Assign an Elastic IP Address to Your Instance
By default, an instance in a nondefault VPC is not assigned a public IP address, and is private.You ...
- Ubuntu setup Static IP Address
Change Ubuntu Server from DHCP to a Static IP Address If the Ubuntu Server installer has set your se ...
- How to configure a static IP address on CentOS 7(CentOS7静态IP地址设置)
Question: On CentOS 7, I want to switch from DHCP to static IP address configuration with one of my ...
随机推荐
- 直接导入用户信息到discuz ucenter.
上一篇帖子: 直接导入帖子到Discuz 论坛数据库. 结束时说要写一篇导入用户的帖子, 一直没时间, 但是咱不能做太监,不是? 所以今天赶快补上. 在做discuz整合或者迁移是, 很多人可能遇到相 ...
- VirtualBox 安装Centos7 无法上网 ping不同的解决方法
进入目录: cd /etc/sysconfig/network-scripts/ 用ls命令查看网卡配置文件名(在CENTOS7中网卡名貌似变成了随机数字,所以每台机器的网卡名并不相同) 编辑网卡配置 ...
- 使用pycharm专业版创建虚拟环境
Location为工程地址 D:\My_python 第二个Location为 虚拟环境放在这个工程下 Base interpreter:基于那个解释器来创建虚拟环境 Create后进入到目录查看下
- 数独高阶技巧入门之七——AIC & Nice Loop
AIC(交替推理链,Alternate Inference Chain) 在简单异数链一文中我们介绍过XY-Chain技法,AIC可以看作是XY-Chain的扩展.有别于XY-Chain仅局限于双值格 ...
- DEV 之 有些控件不允许拖动。
DEV 之 有些控件不允许拖动. 设置一个参数即可解决问题
- Java中获取运行代码的类名、方法名
以下是案例,已运行通过 package com.hdys; /* * 1.获取当前运行代码的类名,方法名,主要是通过java.lang.StackTraceElement类 * * 2. * [1]获 ...
- c++ inline使函数实现可以在头文件中,避免多重定义错误
作者:Jon Lee链接:https://www.zhihu.com/question/53082910/answer/133612920来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业 ...
- django学习篇
https://www.cnblogs.com/alex3714/category/818260.html https://www.cnblogs.com/zhanghongfeng/catego ...
- python 使用跨平台文件锁
#encoding=utf-8 print '中国' #使用跨平台文件锁 import os if os.name == 'nt': import win32con,win32file,pywinty ...
- 关于C#低版本升级高版本时,项目中引用Microsoft.Office.Interop.Word,程序提示不存在类型或命名空间名office.
Report.cs里using Microsoft.Office.Interop.Word;就会报错:编译器错误消息: CS0234: 命名空间“Microsoft.Office”中不存在类型或命名空 ...