题意:给你n个r进制数,让你求和。

析:思路就是先转化成十进制,再加和。

代码如下:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <cstring>
#include <map> using namespace std;
const int maxn = 70;
char s[maxn]; int main(){
int n;
while(~scanf("%d", &n)){
int sum = 0;
while(n--){
int ss = 0;
scanf("%s", s);
int tt;
for(tt = 0; s[tt] != '('; ++tt) ; int t = 0;
for(int i = tt+1; s[i] != ')'; ++i)
t = t * 10 + s[i] - '0'; for(int i = 0; s[i] != '('; ++i)
ss = ss * t + s[i] - '0';
sum += ss;
} printf("%d\n", sum);
}
return 0;
}

HDU 2106 decimal system (进制转化求和)的更多相关文章

  1. HDOJ(HDU) 2106 decimal system(进制相互转换问题)

    Problem Description As we know , we always use the decimal system in our common life, even using the ...

  2. hdu 2106 decimal system

    #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> # ...

  3. python数据结构:进制转化探索

    *********************************第一部分*************************************************************** ...

  4. HDU5050:Divided Land(大数的进制转化与GCD)

    题意:给定大数A和B,求gcd.所有数字都是二进制. 思路:先输入字符串,再转化为大数,然后用大数的gcd函数,最后转化为字符串输出. 利用字符串和大数转化的时候可以声明进制,就很舒服的完成了进制转化 ...

  5. 【风马一族_C】进制转化

    #include "stdio.h" #include "Math.h" #define number 50 //设置数组的长度 int num10; //十进 ...

  6. c语言进制转化

    #include <stdio.h> // 进制转化 int main(void) { ; ; int i3 = 0x32C; printf( printf( printf("十 ...

  7. 编码/解码和进制转化工具hURL

    编码/解码和进制转化工具hURL   在安全应用中,各种编码方式被广泛应用,如URL编码.HTML编码.BASE64等.而在数据分析时候,各种进制的转化也尤为频繁.为了方便解决这类问题,Kali Li ...

  8. 《N诺机试指南》(五)进制转化

    进制转化类题目类型: 代码详解及注释解答:  //进制转化问题 #include <bits/stdc++.h> using namespace std; int main(){ // 1 ...

  9. P1017进制转化

    P1017进制转化 也不知道为啥,这么简单的题困扰了我这么长时间 #include<cstdio> using namespace std; int m; //被除数= 除数*商 + 余数 ...

随机推荐

  1. Redis基本操作-string

    Redis的5种数据结构:string.list.hash.set和zset; Redis 所有的数据结构都是以唯一的 key 字符串作为名称,然后通过这个唯一 key 值来获取相应的 value 数 ...

  2. ABAP-HTML浏览器

  3. vue基础——表单输入绑定

    一.基础用法 你可以用 v-model 指令在表单 <input> 及 <textarea> 元素上创建双向数据绑定.它会根据控件类型自动选择正确的方法来更新元素. 尽管有些神 ...

  4. storyboard中UIButton setframe 不起作用

    将storyboard的autolayout选项关掉!(暂时没发现具体什么原因.)

  5. Jquery detect page refresh

    first thing there are 3 functions we will use: function setCookie(c_name, value, exdays) {           ...

  6. 播放一个wav文件

    use mmsystem;SndPlaySound('hello.wav',SND_FILENAME or SND_SYNC) ///////////////////////////////////u ...

  7. 用R包来下载sra数据

    1)介绍 我们用SRAdb library来对SRA数据进行处理. SRAdb 可以更方便更快的接入  metadata associated with submission, 包括study, sa ...

  8. HttpClient 发送 HTTP、HTTPS

    首先说一下该类中需要引入的 jar 包,apache 的 httpclient 包,版本号为 4.5,如有需要的话,可以引一下.     代码 import org.apache.commons.io ...

  9. java swing:文本框添加滚动条

    有几点要注意: 1.默认的滚动条,仅在输入的文本超过文本框时才会显示..没有超过文本框是不会显示的: 2.设置矩形大小,是在滚动条上设置,而不是在文本框上设置: 示例代码如下: public clas ...

  10. 早停法(Early Stopping)

    一.早停法简介(Early Stopping)当我们训练深度学习神经网络的时候通常希望能获得最好的泛化性能(generalization performance,即可以很好地拟合数据).但是所有的标准 ...