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 ...
随机推荐
- sqlite数据库的char,varchar,text,nchar,nvarchar,ntext的区别(转)
sqlite数据库存储table1.CHAR.CHAR存储定长数据很方便,CHAR字段上的索引效率级高,比如定义char(10),那么不论你存储的数据是否达到了10个字节,都要占去10个字节的空间,不 ...
- Verilog MIPS32 CPU(六)-- MDU
Verilog MIPS32 CPU(一)-- PC寄存器 Verilog MIPS32 CPU(二)-- Regfiles Verilog MIPS32 CPU(三)-- ALU Verilog M ...
- [Erlang14]怎样模拟节点互连后的各种失败情况?
情景: 当节点群互连时,会通过心跳包检查所连接节点是不是连接正常,这个心跳时间默认为60s,可以通过 net_kernel:set_net_ticktime(600). 来重设这个时间值,怎么测试? ...
- java web 中分布式 session 的实现
已经有现成的库现实现分布式的 session 管理: 1.memcached-session-manager. 2.tomcat-redis-session-manager. 3.spring-ses ...
- ES6——数据结构 Map
数据结构 Map 字典: 用来存储不重复key的 Hash结构.不同于集合(Set)的是,字典使用的是 [键,值] 的形式来存储数据的. JavaScript 的对应那个(Object:{}) 只能用 ...
- vim 在 cmdline 内粘贴的方法
vim 在 cmdline 内粘贴的方法: 先按下 Ctrl-r ,然后选择从哪个剪贴板上粘贴 0 (yank register), 1 to 9 (shifting delete registers ...
- coffee主题美化内容概要
1.具备自动生浮动标题目录(可隐藏) 2.页首目录概要 3.主标题有明显的标志背景颜色,二级标题缩进合适 4.一级.二级标题下图片缩进合适 5.博客签名 6.背景音乐列表 7.打赏 8.联系方式(QQ ...
- 原生态js展开收缩
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 模块sys, os, glob, pickle, subprocess常见用法
参考python常用标准库 http://blog.51cto.com/lizhenliang/1872538 一. sys 1. sys.argv 脚本名1.py, 命令行中执行python 1 ...
- 本地搭建GitLab
现在很多企业都开始使用gitLab,因为他的权限管理强大,后台项目管理也很方便.下面就介绍本地搭建方法: 为避免损失,建议在虚拟机测试.虚拟机最低配置(内存2G,cpu:2核,硬盘:20G) 1.安装 ...