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. ListView的cacheColorHint与listSelector物业和fragment里面onActivityResult问题没有响应

    fragment里面onActivityResult 如何才华被称之为.在使用时发现没反应,没注意这个问题谁. 多方法都不是非常方便.最终实验除了一个最简单的方法. startActivityForR ...

  2. org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the

    org.apache.subversion.javahl.ClientException: svn: E155021: This client is too old to work with the ...

  3. oracle物化视图使用+hibernate

    使用过程 ----删除 TRUNCATE TABLE mlog$_xxx_lxz_tmp;DROP MATERIALIZED VIEW LOG ON xxx_lxz_tmp; drop materia ...

  4. 双链表---LinkedList的重写

    重写Linkedlist类,改写为MyLinkedList,未继承Iterable类. public class MyLinkedList<AnyType> { private int t ...

  5. [渣译文] SignalR 2.0 系列: 支持的平台

    原文:[渣译文] SignalR 2.0 系列: 支持的平台 英文渣水平,大伙凑合着看吧,并不是逐字翻译的…… 这是微软官方SignalR 2.0教程Getting Started with ASP. ...

  6. Atitit.软件GUIbutton和仪表板(01)--警报系统--

    Atitit.软件GUIbutton和仪表板(01)--警报系统-- 1. 温度报警防区(鲁大师,360taskman) 1 2. os-区-----cpu_mem_io资源占用监測 1 3. Vm区 ...

  7. c#获取页面重定向url

    /// <summary> /// 获取页面重定向url /// </summary> /// <param name="url"></p ...

  8. JSON连载java目的

    一. 前台(JS  面向对象) 1. 定义SearchView对象 function SearchView() { } SearchView.prototype.setViewName = funct ...

  9. iOS pragma mark要使用

    郝萌主倾心贡献,尊重作者的劳动成果.请勿转载. 假设文章对您有所帮助.欢迎给作者捐赠.支持郝萌主,捐赠数额任意.重在心意^_^ 我要捐赠: 点击捐赠 Cocos2d-X源代码下载:点我传送 简单的来说 ...

  10. ignore,neglect,omit,overlook

    一:简介——ignore :通常指有意不顾,或不理显而易见的事物.neglect :侧重指有意的忽略或忽视,也可指粗心与疏忽.omit :指有意或无意地忘记做某事,也指删去被视作不重要.不合意的东西. ...