zoukankan      html  css  js  c++  java
  • hdu 5186 zhx's submissions

    /* ***********************************************
    Author        :xryz
    Email         :523689985@qq.com
    Created Time  :4-3 20:18:06
    File Name     :h5186.cpp
    ************************************************ */
    
    #include <stdio.h>
    #include <string.h>
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <queue>
    #include <set>
    #include <map>
    #include <string>
    #include <math.h>
    #include <stdlib.h>
    #include <time.h>
    using namespace std;
    
    int main()
    {
        int i,j,n,b,m[1024],len,f;
    	char s[1024];
    	while(~scanf("%d%d",&n,&b))
    	{
    		f=0;
    		memset(m,0,sizeof(m));
    		for(j=1;j<=n;j++)
    		{
    			//getchar();
    			scanf("%s",s);
    			//printf("%d %s
    ",i,s);
    			len=strlen(s);
    			for(i=0;i<len;i++)
    			{
    				if(s[len-i-1]<='9'&&s[len-i-1]>='0')
    				{
    					m[i]+=s[len-i-1]-48;
    				}
    				else
    					m[i]+=s[len-i-1]-'a'+10;
    				m[i]%=b;
    				//printf("%d
    ",m[i]);
    			}
    		}
    		int cnt=1000;
    		while(cnt>1&&m[cnt-1]==0) cnt--;
    		for(i=cnt-1;i>=0;i--)
    		{
    				if(m[i]>=10) printf("%c",m[i]-10+'a');
    				else printf("%c",m[i]+48);
    		}
            printf("
    ");
    	}
        return 0;
    }

    版权声明:本文为博主原创文章,未经博主允许不得转载。http://xiang578.top/

  • 相关阅读:
    000_linux之Ubuntu安装
    001_linux基础命令
    018_linux驱动之_阻塞和非阻塞
    019_linux驱动之_定时器的引入
    017_linux驱动之_信号量
    016_linux驱动之_原子操作
    python logging模块整理
    python sys与shutil模块
    python configparser模块
    python os模块
  • 原文地址:https://www.cnblogs.com/xryz/p/4848052.html
Copyright © 2011-2022 走看看