POJ 2105 IP Address(简单模拟)
来源:互联网 发布:淘宝助理批量下架 编辑:程序博客网 时间:2024/06/14 09:49
题目地址:http://poj.org/problem?id=2105
思路:模拟
AC代码:
#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <queue>#include <stack>#include <map>#include <cstring>#include <climits>#include <cmath>#include <cctype>const int inf = 0x3f3f3f3f;//1061109567typedef long long LL;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;char a[40];int main(){ int t; scanf("%d",&t); while(t--) { scanf("%s",a+1); int sum = 0; for(int i=1; i<=8; i++) { int x = 8 - i; sum +=(a[i] - '0')* pow(2,x); } printf("%d.",sum); sum = 0; for(int i=9; i<=16; i++) { int x = 16 - i; sum +=(a[i] - '0')* pow(2,x); } printf("%d.",sum); sum = 0; for(int i=17; i<=24; i++) { int x = 24 - i; sum +=(a[i] - '0')* pow(2,x); } printf("%d.",sum); sum = 0; for(int i=25; i<=32; i++) { int x = 32 - i; sum +=(a[i] - '0')* pow(2,x); } printf("%d\n",sum); } return 0;}
0 0
- POJ 2105 IP Address(简单模拟)
- POJ 2105 IP Address
- poj 2105 IP Address
- poj 2105 IP Address
- POJ 2105 IP Address
- [2105]IP Address (POJ)
- IP Address(POJ--2105
- IP Address POJ 2105
- poj 2105 IP Address
- POJ 2105 IP Address
- POJ 2105 IP Address
- POJ 2105 IP Address
- poj-2105-IP Address
- POJ 2105 IP Address(水题)
- POJ 2105 IP Address(水~)
- poj 2105 IP Address(水题)
- OpenJudge/Poj 2105 IP Address
- POJ 2105 IP Address G++
- MBR引导系统启动的几个概念
- Ubuntu下挂载Windows分区
- 欢迎使用CSDN-markdown编辑器
- 【平衡树】splay
- Emacs快速指南摘要
- POJ 2105 IP Address(简单模拟)
- Minds without fear——by Rabindranath Tagore
- 数据结构之排序:直接插入排序
- 从招聘信息来看,小米、爱奇艺、360甚至芒果TV都要做VR了
- [BZOJ1101][POI2007]Zap(莫比乌斯反演)
- vb.net实现邮件发送
- 关于NSString和NSMutableString的相关用法和基本介绍
- visual studio 2013设置字体
- Mac 文字编辑快捷键