hdu-1877(大数+进制转换)】的更多相关文章

NUMBER BASE CONVERSION Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4652   Accepted: 2132 Description Write a program to convert numbers in one base to numbers in a second base. There are 62 different digits: { 0-9,A-Z,a-z } HINT: If…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1877 思路:注意考虑0,0的情况. #include<iostream> #include<cstdio> #include<string> #include<algorithm> using namespace std; int m,a,b; string s1,s2; string add(string s1,string s2) { if(s1.lengt…
普通的做法,大数除小数. 复杂度o( log(n)*log(n) ),其实就是位数的平方. NUMBER BASE CONVERSION Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4913   Accepted: 2246 Description Write a program to convert numbers in one base to numbers in a second base. There are…
题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1030 题目: 代码实现如下: import java.math.*; import java.util.*; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s = sc.next(); Syste…
NPY and FFT Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 799    Accepted Submission(s): 492 Problem Description A boy named NPY is learning FFT algorithm now.In that algorithm,he needs to do…
看了http://lovnet.iteye.com/blog/1690276的答案 好巧妙的方法 递归实现十进制向m进制转换 #include "stdio.h" int m; void CK(int n) { if(n>=m) CK(n/m); printf("%d",n%m); } int main() { int a,b; while(~scanf("%d",&m)&&m) { scanf("%d%d…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2031 进制转换 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 60988    Accepted Submission(s): 33224 Problem Description 输入一个十进制数N,将它转换成R进制数输出.   Input…
解题报告:这题就用一个进制转换的函数就可以了,不需要转换成相应的进制数,只要求出相应进制的数的各位的和就可以了. #include<cstdio> #include<string> #include<cstring> #include<map> #include<iostream> using namespace std; int trans(int x,int r) { ; while(x) { sum += x%r; x/=r; } retu…
进制转换 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 63039    Accepted Submission(s): 34261 Problem Description 输入一个十进制数N,将它转换成R进制数输出.   Input 输入数据包含多个测试实例,每个测试实例包含两个整数N(32位整数)和R(2<=R<=16, R<…
进制转换 + 大整数取模一,题意: 在b进制下,求p%m,再装换成b进制输出. 其中p为b进制大数1000位以内,m为b进制数9位以内二,思路: 1,以字符串的形式输入p,m; 2,转换:字符串->整数 十进制->b进制; 3,十进制下计算并将整形结果转换成字符串形式,并倒序储存; 4,输出.三,步骤: 1,输入p[],m[]; 2,字符串->整形 + 进制->b进制: i,进制转换语句:m2 = m2*b + m[j]-'0'; ii,大整数取模,大整数可以写成这样的形式: 12…