题目连接:1220 NUMBER BASE CONVERSION 题目大意:给出两个进制oldBase 和newBase, 以及以oldBase进制存在的数.要求将这个oldBase进制的数转换成newBase进制的数. 解题思路:短除法,只不过时直接利用了高精度的除法运算, 并且将以前默认的*10换成的*oldBase. #include <stdio.h> #include <string.h> const int N = 1005; int newBase, oldBase,…
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 you make a sequence of base conversions using the output of one conversion as the input to the next, when…
NUMBER BASE CONVERSION Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5976   Accepted: 2738 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…
题目链接 题意 : 给你一个a进制的数串s,让你转化成b进制的输出. A = 10, B = 11, ..., Z = 35, a = 36, b = 37, ..., z = 61,0到9还是原来的含义. 思路 : 这个题因为牵扯了英文字母所以比较复杂一点,先将所有出现的英文字母转化成他们所代表的数,然后进行进制转换. //POJ 1220 #include <stdio.h> #include <string.h> #include <iostream> #incl…
package com.njupt.acm; import java.math.BigInteger; import java.util.Scanner; public class POJ_1220_1 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while(t > 0){ BigInteger ba1 = scann…
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers. Although palindromic numbers are most often cons…
题目链接 题意 : 将一个10进制整数转化为-2进制的数. 思路 :如果你将-2进制下的123转化为十进制是1*(-2)^2+2*(-2)^1+3*(-2)^0.所以十进制转化为-2进制就是一个逆过程.找到最小的非负整数x使得当前数减x能被2整除,这个x将作为新的最高位写到结果中,然后当前数减去x再除以-2,貌似在这里不能严格的说是余数,因为负数的余数不太准确. //POJ 3191 #include <stdio.h> #include <string.h> #include &…
题意为进制转换,Java的大数类就像是作弊 import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); while(n!=0){ int a=in.nextInt(); int b=in.nextInt(); St…
Basic remains Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5221   Accepted: 2203 Description Given a base b and two non-negative base b integers p and m, compute p mod m and print the result as a base b integer. p mod m is defined as…
The Embarrassed Cryptographer Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 15767   Accepted: 4337 Description The young and very promising cryptographer Odd Even has implemented the security module of a large system with thousands of…