Problem Description
As we know , we always use the decimal system in our common life, even using the computer. If we want to calculate the value that 3 plus 9, we just import 3 and 9.after calculation of computer, we will get the result of 12.
But after learning <<The Principle Of Computer>>,we know that the computer will do the calculation as the following steps:
1 computer change the 3 into binary formality like 11;
2 computer change the 9 into binary formality like 1001;
3 computer plus the two number and get the result 1100;
4 computer change the result into decimal formality like 12;
5 computer export the result;

In the computer system there are other formalities to deal with the number such as hexadecimal. Now I will give several number with a kind of change method, for example, if I give you 1011(2), it means 1011 is a number in the binary system, and 123(10) means 123 if a number in the decimal system. Now I will give you some numbers with any kind of system, you guys should tell me the sum of the number in the decimal system.

 
Input
There will be several cases. The first line of each case contains one integers N, and N means there will be N numbers to import, then there will be N numbers at the next N lines, each line contains a number with such form : X1….Xn.(Y), and 0<=Xi<Y, 1<Y<=10. I promise you that the sum will not exceed the 100000000, and there will be at most 100 cases and the 0<N<=1000.
 
Output
There is only one line output case for each input case, which is the sum of all the number. The sum must be expressed using the decimal system.
 
Sample Input
3
1(2)
2(3)
3(4)

4
11(10)
11(2)
11(3)
11(4)

 
Sample Output
6
23
 #include <iostream>
using namespace std; int pow(int m,int n)//求m的n次幂
{
long int pro = ;
while(n--)
pro *= m;
return pro;
} int main()
{
int T,p,q;//k为指数 16 char left_arc,right_arc;
while (cin >> T)
{
int sum = ;
while(T--)
{
int k = ;
23 cin >> p >> left_arc >> q >> right_arc; while (p != )
{
sum += p % * pow(q,k++);
p /= ;
}
}
cout << sum << endl;
} return ;
}

decimal system 2016的更多相关文章

  1. 十进制(decimal system)转换函数说明

    一,十进制(decimal system)转换函数说明 1,十进制转二进制 decbin() 函数,如下实例 echo decbin(12); //输出 1100 echo decbin(26); / ...

  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. 杭电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> ...

  6. China Operating System 电脑操作系统 2016全球互联网排名

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 电脑操作系统 China Operating System 2016全球互联网排名 == ...

  7. decimal,float和double的区别

    http://www.cnblogs.com/yellowapplemylove/archive/2011/08/23/2150316.html 一直很奇怪C#的预定义数据类型中为什么加了一个deci ...

  8. float,double,decimal使用讨论

    注意:有效位:小数点前后的全部数字,不包括小数点在内 float:浮点型,含字节数为4,32bit,数值范围为-3.4E38~3.4E38(7个有效位) double:双精度实型,含字节数为8,64b ...

  9. float,double和decimal的精度问题

    先标注一个音标,因为我老是读错:decimal ['desɪml] 精度对比: 类型 CTS 类型 描述 有效数字 范围 float System.Single 32-bit single-preci ...

随机推荐

  1. js“分享到”侧边框伸缩实现

    思路: 1,临界值是 -150 和 0 如果大于临界值,就要隐藏 2,隐藏:速度为负 显示:速度为正 3,如果与临界值相等,就清空定时器 否则,就运动 ------------------------ ...

  2. mysql 插入Emoji表情报错

    今天做的了个获取微信粉丝的功能,发现将昵称插入数据库报错.长度肯定是够的 Incorrect string value: '\xF0\x9F\x98\x84\xF0\x9F 找了点资料发现UTF-8编 ...

  3. JAVA开源爬虫,WebCollector,使用方便,有接口。

    假设你想下载整个网站内容爬行动物,我不希望配置heritrix复杂的爬行动物,要选择WebCollector.项目github一个不断更新. github源地址:https://github.com/ ...

  4. 在Apk应用程序内,查找某个Activity。

    转载请注明出处:http://blog.csdn.net/droyon/article/details/39933677 Intent intent = new Intent(Intent.ACTIO ...

  5. HDU 1274 展开字符串 (递归+string类)

    题目链接:HDU 1274 展开字符串 中文题. 左括号进入DFS函数,右括号return到上一层. 注意return回去的是这个一层递归中的括号中的字母串. AC代码: #include<st ...

  6. Make a dent in the universe

    李自成<一个数学家平反>.就像我第一次读同一,我感到鼓舞的野心文."野心是世界的驱动力的最好的结果几乎所有的工作. " 心野心是要留下点什么在自己身后的永恒价值 在这个 ...

  7. Spark Executor Driver资源调度汇总

    一.简介 于Worker Actor于,每次LaunchExecutor这将创建一个CoarseGrainedExecutorBackend流程.Executor和CoarseGrainedExecu ...

  8. Struts2 + uploadify 多文件上传完整的例子!

    首先,我这里使用的是  Jquery  Uploadify3.2版本号  导入相关的CSS  JS    <link rel="stylesheet" type=" ...

  9. css Tab选项卡1

    利用   锚点原理 以及overflow:hiden 结合,实现纯  css  tab 方式 兼容ie6 + 适合单个tab   不需要js          注意点  红色方框的   a 对应a   ...

  10. Hadoop加zookeeper构建高可靠集群

    事前准备 1.更改Linux主机名,每个人都有配置 vim /etc/sysconfig/network NETWORKING=yes HOSTNAME=hadoop-server1 2.改动IP / ...