#include <iostream>
#include <cmath>
#include <string.h>
using namespace std;
int main()
{
int sum,m,len,t,i,k,s;
char a[1001];
while(cin>>t)
{
sum=0;
while(t--)
{
cin>>a;
m=0;
len=strlen(a);
for(i=0;i<len;i++) {if(a[i]=='('&&a[i+2]=='0') {m=10;k=i+1;break;}
if(a[i]=='(') {k=i+1;m=a[k]-'0';break;}}
//m+=a[k];
//cout<<a[k]<<" "<<m<<" "<<sum<<endl;
//cout<<sum<<endl; s=k;
//cout<<m<<endl;
for(i=0;i<s-1;i++,k--)
{ sum=sum+(a[i]-'0')*(pow(m*1.0,double(k-2)));
//cout<<a[i]-'0'<<" "<<pow(m,k-2)<<" "<<sum<<endl;
}//cout<<sum<<endl; //cout<<a[i]<<" "<<pow(a[k],k-2)<<" "<<sum<<endl; }cout<<sum<<endl;} return 0;
}

hdu 2106 

关于这道题的解题报告,我只想说的是,一个char转int一直都没想出来啊。。。。上面的代码不知道为什么在杭电上提交的时候出现编译错误。。。

后面看了,是pow函数里默认是double型。。。。ORZ

hdu 2106的更多相关文章

  1. HDU 2106 母猪的故事

    http://acm.hdu.edu.cn/showproblem.php?pid=2160 Problem Description 话说现在猪肉价格这么贵,著名的ACBoy 0068 也开始了养猪生 ...

  2. HDOJ(HDU) 2106 decimal system(进制相互转换问题)

    Problem Description As we know , we always use the decimal system in our common life, even using the ...

  3. hdu 2106 decimal system

    #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> # ...

  4. HDU 2106 decimal system (进制转化求和)

    题意:给你n个r进制数,让你求和. 析:思路就是先转化成十进制,再加和. 代码如下: #include <iostream> #include <cstdio> #includ ...

  5. (HDU 5558) 2015ACM/ICPC亚洲区合肥站---Alice's Classified Message(后缀数组)

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5558 Problem Description Alice wants to send a classi ...

  6. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  7. hdu 1240:Asteroids!(三维BFS搜索)

    Asteroids! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  8. HDU 2101 A + B Problem Too 分类: ACM 2015-06-16 23:57 18人阅读 评论(0) 收藏

    A + B Problem Too Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  9. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

随机推荐

  1. 我的vimrc配置

    fankcoder@fankcoder:~$ cat ~/.vimrclet Tlist_Auto_Highlight_Tag=1 let Tlist_Auto_Open=1 let Tlist_Au ...

  2. sizeof(int *) 和 sizeof(int)型的大小问题

    小问题,暂时记录注意一下   printf("sizeof(int): %d\n", (int)sizeof(int));     printf("sizeof(int ...

  3. 或许是python yield最好的答案 ?

    地址:http://pyzh.readthedocs.org/en/latest/the-python-yield-keyword-explained.html#yield 译者: hit9 原文: ...

  4. CSU 1160(进制问题)

    CSU 1160   Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu   Descrip ...

  5. Android模拟器genymotion安装与eclipse 插件安装

    推荐一款Android模拟器"Genymotion",有点速度快,占用资源少,可整合eclipse.闲话少谈,看安装步骤. 1.下载地址:https://www.genymotio ...

  6. mschedule 简单linux进程管理(树莓派)

    树莓派是神奇的机器,CPU和内存都少的可怜,但体积小功耗低,在上面搞些动搞些西其实也挺有意思,挺好玩的.装的是pidara,基本服务没有精简多少,先cat一下CPU和RAM. [able@raspi ...

  7. spring-boot 测试

    在线项目构建:http://start.spring.io/ 下载:bookpub.zip 导入Idea15.0.1 运行: y@y:bookpub$ ./gradlew clean bootRun ...

  8. Mahout

    http://blog.csdn.net/yueyedeai/article/details/26567379

  9. 【转】 Linux中的工作队列

    原文网址:http://blog.chinaunix.net/uid-20583479-id-1920134.html 工作队列一般用来做滞后的工作,比如在中断里面要做很多事,但是比较耗时,这时就可以 ...

  10. HDOJ(HDU) 2083 简易版之最短距离(中位数)

    Problem Description 寒假的时候,ACBOY要去拜访很多朋友,恰巧他所有朋友的家都处在坐标平面的X轴上.ACBOY可以任意选择一个朋友的家开始访问,但是每次访问后他都必须回到出发点, ...