PAT A1010.Radix 二分法】的更多相关文章

PAT A1010.Radix 链接: https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536 算法笔记实战指南P167 题意: 给2个数:N和M,给出N的进制,求出M的进制为多少时,才能与N相同,如果不存在这样的进制,给出“Impossible” N 和 M 都以字符串的形式给出,最多10个digits,从‘0’-‘9’,‘a’-‘z’,代表0-35 注意: 1. 虽然M每位最大是35,但是M的…
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…
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…
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…
题目 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…
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 rad…
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 o…
https://www.patest.cn/contests/pat-a-practise/1010 题目大意: 输入四个数字,a,b,c,d. a和b是两个数字,c=1表示是第一个数字,c=2表示是第二个数字,d表示该数字是几进制 问:a和b是否能在某一进制下相等 思路: 傻逼二分... 一年没写过了,细节思考竟然差了这么多,尴尬了... //看看会不会爆int!数组会不会少了一维! //取物问题一定要小心先手胜利的条件 #include <bits/stdc++.h> using name…
一.技术总结 首先得写一个进制转换函数convert(),函数输入参数是字符串str和需要转化的进制(使用long long数据类型).函数内部知识,使用函数迭代器,即auto it = n.rbegin(),这里it作用就是指针一样,装的是地址,了解函数begin()是返回字符串str的一个元素地址和函数end()是返回字符串最后一个元素还要往后一位,而rbegin()和rend(),加了r后刚刚反过来了,rbegin()指向str的最后一个元素,rend()指向第一个元素还要往前一位. 第二…
1010 Radix (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 N​1​​ and N​2​​, your task…