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 ...
随机推荐
- Oracle db中 CONNECT role的含义
出自: Complete Checklist for Manual Upgrades to 11gR2 (文档 ID 837570.1) 该文章中有例如以下的文字: From Oracle 10.2, ...
- 网页信息抓取进阶 支持Js生成数据 Jsoup的不足之处
转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/23866427 今天又遇到一个网页数据抓取的任务,给大家分享下. 说道网页信息抓取 ...
- [LeetCode129]Sum Root to Leaf Numbers
题目: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a nu ...
- Directx11学习笔记【十四】 使用最新的Effect框架和SDK
由于之前一直在看directx11龙书学习,因此sdk一直用的Microsoft DirectX SDK (June 2010) 版本,最近在stackoverflow上问dx11相关问题时,一直被大 ...
- spring mvc 错误摘要--。位。
1....identifier of an instance of org.szgzw.ent.profile.baseinfo.enterprise.EnterpriseEntity was alt ...
- 玩转Web之Json(一)-----easy ui+ajax + json 中关于Json的解析问题
在easy ui中使用Ajax+Json实现前后的数据交互时,当后台数据传输到客户端是需对Json数据进行解析,这里将对Json数据解析做简单总结. (一) 对于服务器返回的数据若没有做类型说明,需要 ...
- 静态常量(static final)在class文件里是如何的呢?
近期写项目遇到一个问题,来回折腾了几次,最终探究清楚了.不废话.上样例. 背景:由于项目小,没有使用配置文件,全部静态常量都放在Config.java里面了 public class Config { ...
- Chapter 1 Securing Your Server and Network(7):禁用SQL Server Browse
原文:Chapter 1 Securing Your Server and Network(7):禁用SQL Server Browse 原文出处:http://blog.csdn.net/dba_h ...
- Jenkins(二) 安装、新建Jobs与删除及SVN配置(转)
官网首页(https://jenkins-ci.org/)就提供了windows版本的Jenkins安装包.可以自己下载一个用于学习.安装后自动打开http://localhost:8080,就可以看 ...
- SELECT 场 FROM 表 WHERE 字段 Like 条件
间有关的条件,SQL它提供了四种匹配模式: 1.%: 表示随意0个或多个字符.可匹配随意类型和长度的字符.有些情况下若是中文,请使用两个百分号(%%)表示. 比方 SELECT * FROM [use ...