hdu 2106 decimal system
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define maxn 1000
using namespace std;
char str[maxn]; int change(char *s)
{
int k=strlen(s);
int pos;
int sum=;
for(int i=; i<k; i++)
{
if(s[i]=='(')
{
pos=i;
break;
}
}
int m;
if(s[pos+]=='')
{
m=;
}
else
m=s[pos+]-'';
int j=;
for(int i=pos-; i>=; i--)
{
sum+=(s[i]-'')*pow(m,j);
j++;
}
return sum;
} int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int sum1=;
for(int i=; i<n; i++)
{
scanf("%s",str);
sum1+=change(str);
}
printf("%d\n",sum1);
}
return ;
}
hdu 2106 decimal system的更多相关文章
- HDOJ(HDU) 2106 decimal system(进制相互转换问题)
Problem Description As we know , we always use the decimal system in our common life, even using the ...
- HDU 2106 decimal system (进制转化求和)
题意:给你n个r进制数,让你求和. 析:思路就是先转化成十进制,再加和. 代码如下: #include <iostream> #include <cstdio> #includ ...
- 十进制(decimal system)转换函数说明
一,十进制(decimal system)转换函数说明 1,十进制转二进制 decbin() 函数,如下实例 echo decbin(12); //输出 1100 echo decbin(26); / ...
- hdu 2106
#include <iostream> #include <cmath> #include <string.h> using namespace std; int ...
- decimal system 2016
Problem Description As we know , we always use the decimal system in our common life, even using the ...
- 杭电OJ(HDU)-ACMSteps-Chapter Two-《An Easy Task》《Buildings》《decimal system》《Vowel Counting》
http://acm.hdu.edu.cn/game/entry/problem/list.php?chapterid=1§ionid=2 1.2.5 #include<stdio.h> ...
- HDU 3072 Intelligence System (强连通分量)
Intelligence System Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- hdu 1690 Bus System(Dijkstra最短路)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1690 Bus System Time Limit: 2000/1000 MS (Java/Others ...
- HDU 4744 Starloop System(ZKW费用流)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4744 题意:三维空间n个点,每个点有一个wi值.每对点的距离定义为floor(欧拉距离),每对点之间建 ...
随机推荐
- poj2063 Investment(多次完全背包)
http://poj.org/problem?id=2063 多次完全背包~ #include <stdio.h> #include <string.h> #define MA ...
- 【HDOJ】1406 Ferry Loading III
模拟,注意需要比较队头与当前时间的大小关系. #include <cstdio> #include <cstring> #include <cstdlib> #de ...
- BZOJ1668: [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富
1668: [Usaco2006 Oct]Cow Pie Treasures 馅饼里的财富 Time Limit: 3 Sec Memory Limit: 64 MBSubmit: 459 Sol ...
- delphi TCXTreelist 通过代码控制行的可编辑性
procedure TfrmSetOutPzTradeDeptPerson.grdTradeClientEditing(Sender: TObject; AColumn: TcxTreeListCo ...
- 读<<如何阅读一本书>>乱七八糟的笔记1
阅读层次 第一层:基础阅读 第二层:检视阅读 系统化略读 第三层:分析阅读 第四层:主题阅读(比较阅读) 第二层:检视阅读 1.有系统的粗读或略读 (1)先看书名页,然后如果有序就先看序 (2)研究目 ...
- (转)Linux下apache限速和限制同一IP连接数的实现
单位有一台DELL的服务器,4核双CPU,4G内存,1TB的存储空间,闲来无事,申请了域名http://www.zxzy123.cn,做了个网站,本以为用这样的配置做个下载站是绰绰有余了,没想到上线没 ...
- INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES错误解决方法
在安装APK文件时出现类似INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES的提示,同时类似的提示如下: Android Launch! adb is run ...
- Python之基础(一)
数学计算 要利用相关的数学计算函数,首先需要把数学模块包含进来: >>>import math 进行计算: >>> math.pi 3.14159265358979 ...
- canvas--画宇宙
<!doctype html><html lang="en"> <head> <meta charset="UTF-8" ...
- 常用webservice网址
http://www.gpsso.com/Main/ServiceList.aspx http://developer.51cto.com/art/200908/147125.htm 这里记录了几个常 ...