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 ...
随机推荐
- 动态规划---状压dp2
今天模拟,状压dp又没写出来...还是不会啊,所以今天搞一下这个状压dp.这里有一道状压dp的板子题: Corn FieldsCorn Fields 就是一道很简单的状压裸题,但是要每次用一个二进制数 ...
- vim gvim技巧大全(9)(转载)
vim gvim技巧大全(9) 2 用命令}移动到这个段落的底部,标记为b3 输入命令:'a,'b move来移动文本.老版本的Vi编辑器不能很好的来处理多文件.但是Vim在处理多文件上却显得优秀得多 ...
- AMD 与 CMD 区别
作者:玉伯链接:https://www.zhihu.com/question/20351507/answer/14859415来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出 ...
- [Apple开发者帐户帮助]一、开始(2)登录您的开发者帐户
使用Apple ID登录您的开发者帐户.如果您注册了付费程序(Apple Developer Program或Apple Developer Enterprise Program),请使用您用于注册的 ...
- S - New Year Transportation
Problem description New Year is coming in Line World! In this world, there are n cells numbered by i ...
- xcode制作越狱后ipa安装文件
正常情况下发布测试版给用户需要问到对方设备ID并添加到开发者证书里去感觉有点麻烦,如果是已越狱过的机器可以使用xcode制作ipa文件,并直接用itunes同步进去,这样方便多了. 将运行目标选为iO ...
- 5.13redis图形化工具---idea中配置redis密码
安装window下的redis,redis可视化管理工具(Redis Desktop Manager)安装,基础使用,实例化项目 源博客地址:https://www.cnblogs.com/cheng ...
- Android_传感器光学
上一篇写了一个小案例方向传感器,与这光学传感器原理大致类似,但其实代码的主要区别得到的类型不一样在这里我一一列举出来: * Sensor.TYPE_ORIENTATION:方向传感器. * Senso ...
- python特性小记(一)
一.关于构造函数和析构函数 1.python中有构造函数和析构函数,和其他语言是一样的.如果子类需要用到父类的构造函数,则需要在子类的构造函数中显式的调用,且如果子类有自己的构造函数,必然不会自动调用 ...
- Mongo连接远程数据库
mongo IP+Port CrabyterV5 首先这么操作是基于配置了环境变量的,可以参照http://www.cnblogs.com/daiyonghui/p/5209076.html mong ...