HDU 5186
easy !!
#include <iostream>
#include <cstdio>
#include <algorithm>
#define LL __int64
using namespace std; int input[],l;
char in[];
struct BigNumber{
int B,len;
int num[];
void init(){
len=;
for(int i=;i<=;i++) num[i]=;
}
void add_BigNubmer(int *a,int l){
len=max(len,l);
// cout<<len<<endl;
int mod,up;
for(int i=;i<len;i++){
mod=(a[i]+num[i])%B;
num[i]=mod;
}
if(num[len]) len++;
}
}; void Init(){
for(int i=;i<=;i++) input[i]=;
} int main(){
BigNumber Number;
int n,B;
while(scanf("%d%d",&n,&B)!=EOF){
Number.init();
Number.B=B;
for(int i=;i<n;i++){
scanf("%s",in);
int len=strlen(in);
l=;
Init();
for(int i=len-;i>=;i--){
if(in[i]>=''&&in[i]<='')
input[l]=in[i]-'';
else if(in[i]>='a'&&in[i]<='z')
input[l]=in[i]-'a'+;
l++;
}
Number.add_BigNubmer(input,l);
}
bool flag=false;
for(int i=Number.len-;i>=;i--){
if(!flag&&Number.num[i]==){
continue;
}
flag=true;
if(Number.num[i]<=)
printf("%c",Number.num[i]+'');
else if(Number.num[i]>)
printf("%c",Number.num[i]-+'a');
}
if(!flag) printf("");
puts("");
}
return ;
}
HDU 5186的更多相关文章
- HDU 5186 zhx's submissions 模拟,细节 难度:1
http://acm.hdu.edu.cn/showproblem.php?pid=5186 题意是分别对每一位做b进制加法,但是不要进位 模拟,注意:1 去掉前置0 2 当结果为0时输出0,而不是全 ...
- HDU - 5186 - zhx's submissions (精密塔尔苏斯)
zhx's submissions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- HDU 5186 zhx's submissions (进制转换)
Problem Description As one of the most powerful brushes, zhx submits a lot of code on many oj and mo ...
- hdu 5186(模拟)
zhx's submissions Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
随机推荐
- 数据预处理之Minkowski距离计算
template <class T1, class T2> double Minkowski(const std::vector<T1> &inst1, const s ...
- CentOS7 内核参数优化
# allow testing with buffers up to 128MBnet.core.rmem_max = 134217728net.core.wmem_max = 134217728# ...
- android apk 防止反编译技术第二篇-运行时修改Dalvik指令
上一篇我们讲了apk防止反编译技术中的加壳技术,如果有不明白的可以查看我的上一篇博客http://my.oschina.net/u/2323218/blog/393372.接下来我们将介绍另一种防止a ...
- E20170821-mk
Dimension n. 尺寸; [复] 面积,范围; [物] 量纲; [数] 次元,度,维;
- JS——事件详情(鼠标事件:clientX、clientY的用法)
鼠标位置 >可视区位置:clientX.clientY 跟着鼠标移动的div案例 代码如下图: 这个案例,运用到前一篇文章中的event事件来处理.获取div的left和top值,当鼠标移动 ...
- 汇编程序18:利用and和or指令变换大小写
assume cs:code,ds:data //and指令使某位变0,or指令使某位变1 data segment db 'BaSic','iNfOrMaTiOn' //db指令:定义字节数据,与d ...
- myeclipse中代码不显示SVN版本号
打开 : windows ->preferences->General->Appearance->Lable Decoration s 勾选其中的 SVN 项即可. 如果以上方 ...
- javaee Properties键值对写入和读取方法
package Zjshuchu; import java.util.Properties; import java.util.Set; public class Demo03 { public st ...
- JQuery的click,trigger触发a标签的click事件无效的问题分析
今天在做一个手机端webAPP链接下载的时候,给a标签一个下载链接,但是通过 <a id="downFile" download="" href=&quo ...
- python tkinter模块小工具界面
代码 #-*-coding:utf-8-*- import os from tkinter import * root=Tk() root.title('小工具') #清空文本框内容 def clea ...