#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. Tinkphp定时发布文章的教程

    第一步:在文章表中加一个字段,用来保存定时发布的时间 假定我把这个字段设为 push_time 默认为 0 第二步:写一个方法来检查文章列表,把文章列表到时间的文章改为发布状态 //定时发布文章 pu ...

  2. 超级易使用的jquery视频背景插件Vide

    http://www.jqcool.net/demo/201410/jquery-vide/ 官网: http://vodkabears.github.io/vide/

  3. JS 操作Dom节点之样式

    为了提高用户体验,我们经常会动态修改Dom节点的样式,各种浏览器差异比较大,我们如何应对?不断尝试,不断总结~! 1. style.getComputedStyle.currentStyle 内嵌样式 ...

  4. TCP回射客户程序:main函数

    创建套接字,装填网际网套接字地址结构 创建一个TCP套接字,用服务器的IP地址和端口号装填一个网际网套接字地址结构 我们可从命令行参数取得服务器的IP地址 从头文件unp.h取得服务器的众所周知端口号 ...

  5. Jedis 一

    //连接Jedis public Jedis getJedis(){ Jedis jedis = new Jedis("192.168.1.12",6379); //权限认证 // ...

  6. C语言学习笔记--字符串函数

    字符串函数 需要包含头文件#include<stdio.h> strlen strcmp strcpy strchr strstr strcasestr

  7. Gradle sync failed: Gradle version 2.2 is required. Current version is 2.10.

    Gradle sync failed: Gradle version 2.2 is required. Current version is 2.10. If using the gradle wra ...

  8. 研究了下apache的漏洞CVE-2012-0053

    发一个大cookie过去,最新版本的,竟然显示了个\n 嘛意思 干嘛不直接删掉 Your browser sent a request that this server could not under ...

  9. POJ2503 Babelfish

    题目链接. 分析: 应当用字典树,但stl的map做很简单. #include <iostream> #include <cstdio> #include <cstdli ...

  10. HBase Java API入门

    概括 1. 创建.删除及启用禁用表.添加列等都需用到HBaseAdmin,另外需要注意删除,添加列等操作都需要禁用表 2. 表中添加数据,查询等都是和HTable相关,如果是多线程的情况下注意用HTa ...