PAT D进制的A+B】的更多相关文章

PAT 1022D进制的A+B 输入两个非负 10 进制整数 A 和 B (≤2​30−1),输出 A+B 的 D (1<D≤10)进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 思路: 由于d是小于等于10的,而且A,B的和最大是小于int的最大值的,所以不用考虑爆int的问题.然后就不断用A,B的和对D进行取模运算.逆序输出即可.代码如下 : #include <io…
进制转换题 PAT (Advanced Level) Practice 进制转换题 目录 <算法笔记> 重点摘要 1015 Reversible Primes (20) 1019 General Palindromic Number (20) 1027 Colors in Mars (20) 1058 A+B in Hogwarts (20) 1100 Mars Numbers (20) <算法笔记> 3.5 进制转换 重点摘要 P进制转换为Q进制,分两步 P进制转换为10进制 /…
输入两个非负 10 进制整数 A 和 B ( <=230-1 ) ,输出 A+B 的 D (1<D<=10) 进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 def convert1(t,k): a=[] if t==0 or t==1: return t else: while t>0: m=str(t%k) a.append(m) t//=k return…
PAT (Basic Level) Practise (中文)-  1022. D进制的A+B (20)  http://www.patest.cn/contests/pat-b-practise/1022 输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样例: 1103 #include<stdio.h…
B1022. D进制的A+B (20) Description: 输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. Input: 输入在一行中依次给出3个整数A.B和D. Output: 输出A+B的D进制数. Sample Input: 123 456 8 Sample Output: 1103 #include <cstdio> int main() { int a, b, d; scanf("%d%d%d&q…
输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样例: 1103要特别注意a+b=0的情况 #include<stdio.h> #include<string.h> #include<math.h> #include<stdlib.h> int main(){ l…
[题目连接] 输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样例: 1103 提交代码: #include <stdio.h> int convert(int a, int b, int c, int *d, int len) { int cnt, x; int calc = a + b; cnt…
1022. D进制的A+B (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样例: 1103___________________________注意 要用long l…
1022 D进制的A+B 输入两个非负 10 进制整数 A 和 B (≤2^30^−1),输出 A+B 的 D (1<D≤10)进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 代码: #include<stdio.h> int fun(int *arr,long long n,int D) { int t=0; while(n) { arr[t++]=n%D; n=…
A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now given any two positive integers N (&…
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N​1​​ and N​2​​, your task is to find the radi…
https://pintia.cn/problem-sets/994805260223102976/problems/994805299301433344 输入两个非负10进制整数A和B(<=2^30^-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样例: 1103 代码: #include <bits/stdc++.h> using na…
D进制的A+B (20) 时间限制 1000 ms 内存限制 32768 KB 代码长度限制 100 KB 判断程序 Standard (来自 小小) 题目描述 输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. 输入描述: 输入在一行中依次给出3个整数A.B和D. 输出描述: 输出A+B的D进制数. 输入例子: 123 456 8 输出例子: 1103 思路分析:A+B都会算,这个题考察的就是进制间的转换 举几个例子: 十进制数10转二…
输入两个非负10进制整数A和B(<=2^30^-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样例: 输入两个非负10进制整数A和B(<=2^30^-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样…
输入两个非负 10 进制整数 A 和 B (≤),输出 A+B 的 D (1)进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 #include <cstdio> #include <iostream> //const int MAXN = 100000; //int score[MAXN] = { 0 }; int main() { int a, b, c,…
1015 Reversible Primes (20)(20 分)提问 A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now…
1010 Radix (25)(25 分) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1 and N2, your t…
输入两个非负10进制整数A和B(<=230-1),输出A+B的D (1 < D <= 10)进制数. 输入格式: 输入在一行中依次给出3个整数A.B和D. 输出格式: 输出A+B的D进制数. 输入样例: 123 456 8 输出样例: 1103 package com.hone.basical; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * 原题目:https://ww…
1022 D进制的A+B (20 point(s)) 输入两个非负 10 进制整数 A 和 B (≤2​30​​−1),输出 A+B 的 D (1<D≤10)进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 这道题主要就是进制转换,我用了递归的思想.不过这样的话要考虑0的情况 也可以把转换完的结果存到数组里面. #include<cstdio> void Change…
本文同步发布在CSDN:https://blog.csdn.net/weixin_44385565/article/details/90678474 1100 Mars Numbers (20 分)   People on Mars count their numbers with base 13: Zero on Earth is called "tret" on Mars. The numbers 1 to 12 on Earth is called "jan, feb,…
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is “yes”, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive integers N1 and N2, your task is to find the radix of…
1022 D进制的A+B (20 分) 题目来源 输入两个非负 10 进制整数 A 和 B (≤),输出 A+B 的 D (1)进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 进制转换(P进制转Q进制): 步骤: 1. 将P进制数转成10进制 给定一个2进制数1011,将其转成10进制: $1*10^3 + 1*10^2 +0*10^1+1*10^0$ = 11 C++实现…
题目链接:1044 火星数字 (20 point(s)) 题目描述 火星人是以 13 进制计数的: 地球人的 0 被火星人称为 tret. 地球人数字 1 到 12 的火星文分别为:jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec. 火星人将进位以后的 12 个高位数字分别称为:tam, hel, maa, huh, tou, kes, hei, elo, syy, lok, mer, jou. 例如地球人的数字 29 翻译成火…
1027 Colors in Mars (20 分)   People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 digits for Green, and th…
1019 General Palindromic Number (20 分)   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. Althoug…
1015 Reversible Primes (20 分)   A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now give…
输入两个非负 10 进制整数 A 和 B (≤),输出 A+B 的 D (1)进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 #include <iostream> #include <stack> using namespace std; int main() { int A,B,radix; cin>>A>>B>>rad…
输入两个非负 10 进制整数 A 和 B (≤),输出 A+B 的 D (1)进制数. 输入格式: 输入在一行中依次给出 3 个整数 A.B 和 D. 输出格式: 输出 A+B 的 D 进制数. 输入样例: 123 456 8 输出样例: 1103 #include <iostream> #include <algorithm> #include <stack> #include <string> #include <cstring> using…
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…
题目 A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now given any two positive integers N…