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 ...
随机推荐
- ZOJ2477 Magic Cube
题目: This is a very popular game for children. In this game, there's a cube, which consists of 3 * 3 ...
- 【贪心】小Y的炮[cannon]题解
模拟赛的题目,做的时候由于第二题表打太久了,只剩下40分钟,想都没想就写了一个爆搜20分... 这道题单调性很关键,下面会解释 P.S.解释在代码里 #include<cstdio> #i ...
- HTML学习(2018.1.18)
1, 转义字符 转义字符:用于表示网页中的特殊字符 XHTML不直接输入符号,建议使用转义字符.  ------空格: ©------版权: & ...
- matplotlib之pyplot 学习示例
现在通过numpy和matplotlib.pyplot 在Python上实现科学计算和绘图,而且和matlab极为相像(效率差点,关键是方便简单) 这里有大量plots代码例子. 1. 简单的绘图( ...
- android开源新闻小程序、3D翻转公告效果、小说检索、Kotlin开发TODO清单等源码
Android精选源码 开源新闻小程序源码分享 android动态壁纸.锁屏动画.来电秀等源码 android笔记App效果源码 Android实现3D版翻页公告效果 android小说搜索阅读源码 ...
- dubbo之本地存根
本地存根 远程服务后,客户端通常只剩下接口,而实现全在服务器端,但提供方有些时候想在客户端也执行部分逻辑,比如:做 ThreadLocal 缓存,提前验证参数,调用失败后伪造容错数据等等,此时就需要在 ...
- 三维重建7:Visual SLAM算法笔记
VSLAM研究了几十年,新的东西不是很多,三维重建的VSLAM方法可以用一篇文章总结一下. 此文是一个好的视觉SLAM综述,对视觉SLAM总结比较全面,是SLAM那本书的很好的补充.介绍了基于滤波器的 ...
- HTML DIV中文字自动换行 , 顶部对齐
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta ht ...
- 团体程序设计天梯赛-练习集-L1-034. 点赞
L1-034. 点赞 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 陈越 微博上有个“点赞”功能,你可以为你喜欢的博文点个赞表示支持 ...
- 【转载】JSTL 标签大全详解
版权声明:本文为博主原创文章,转载请注明出处,冷血之心的博客. https://blog.csdn.net/qq_25827845/article/details/53311722 (尊重劳动成果,转 ...