decimal system 2016
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.
1(2)
2(3)
3(4)
4
11(10)
11(2)
11(3)
11(4)
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的更多相关文章
- 十进制(decimal system)转换函数说明
一,十进制(decimal system)转换函数说明 1,十进制转二进制 decbin() 函数,如下实例 echo decbin(12); //输出 1100 echo decbin(26); / ...
- 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
#include <cstdio> #include <cstring> #include <algorithm> #include <cmath> # ...
- HDU 2106 decimal system (进制转化求和)
题意:给你n个r进制数,让你求和. 析:思路就是先转化成十进制,再加和. 代码如下: #include <iostream> #include <cstdio> #includ ...
- 杭电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> ...
- China Operating System 电脑操作系统 2016全球互联网排名
韩梦飞沙 韩亚飞 313134555@qq.com yue31313 han_meng_fei_sha 电脑操作系统 China Operating System 2016全球互联网排名 == ...
- decimal,float和double的区别
http://www.cnblogs.com/yellowapplemylove/archive/2011/08/23/2150316.html 一直很奇怪C#的预定义数据类型中为什么加了一个deci ...
- float,double,decimal使用讨论
注意:有效位:小数点前后的全部数字,不包括小数点在内 float:浮点型,含字节数为4,32bit,数值范围为-3.4E38~3.4E38(7个有效位) double:双精度实型,含字节数为8,64b ...
- float,double和decimal的精度问题
先标注一个音标,因为我老是读错:decimal ['desɪml] 精度对比: 类型 CTS 类型 描述 有效数字 范围 float System.Single 32-bit single-preci ...
随机推荐
- 模板引擎mustache.js
Javascript模板引擎mustache.js详解 阅读目录 1. 从一个简单真实的需求讲起 2. mustache的用法 3. mustache的思想 4. {{prop}}标签 5. {{ ...
- SqlBulkCopy批量插入数据时,不执行触发器和约束的解决方法
原文:SqlBulkCopy批量插入数据时,不执行触发器和约束的解决方法 在new SqlBulkCopy对象的时候,设置一下SqlBulkCopyOptions选项即可,按位或运算 SqlBulkC ...
- WPF下的视频录制界面设计
原文:WPF下的视频录制界面设计 在去年12月份,我曾经写过三篇文章讨论C#下视频录制.播放界面的设计.这三篇文章是:利用C#画视频录制及播放的界面(一) 利用C#画视频录制及播放的界面(二)利用C# ...
- Qt5该插件机制(2)--QxxxFactory类和QFactoryLoader类别
<<<<<<<<<<<<<<<<<<<<<<<<< ...
- [LeetCode217]Contains Duplicate
题目:Given an array of integers, find if the array contains any duplicates. Your function should retur ...
- [ACM] HUST 1017 Exact cover (Dancing Links,DLX模板题)
DESCRIPTION There is an N*M matrix with only 0s and 1s, (1 <= N,M <= 1000). An exact cover is ...
- android应用框架构建------AppManager
体验一些Android应用程序开发的个人总结 当我们开发应用程序.经常有非常多非常多activity,在这一刻,我们需要一个activity堆栈,以帮助管理activity的finish和start. ...
- UBuntu经常使用的操作(网络资源)
http://docs.google.com/Doc? id=dqsbw4c_46d89djccr 版权声明:本文博主原创文章.博客,未经同意不得转载.
- js中推断对象详细类型
大家可能知道js中推断对象类型能够用typeof来推断. 看以下的情况 <script> alert(typeof 1);//number alert(typeof "2&quo ...
- T-SQL技术收集——删除重复数据
原文:T-SQL技术收集--删除重复数据 在工作和面试中,经常出现如何查询或者删除重复数据的问题,如果有主键,那还好办一点,如果没有主键,那就有点麻烦. 当一个表上没有辅助键时,如果使用SSMS界面来 ...