A1010 Radix (25 分)】的更多相关文章

一.技术总结 首先得写一个进制转换函数convert(),函数输入参数是字符串str和需要转化的进制(使用long long数据类型).函数内部知识,使用函数迭代器,即auto it = n.rbegin(),这里it作用就是指针一样,装的是地址,了解函数begin()是返回字符串str的一个元素地址和函数end()是返回字符串最后一个元素还要往后一位,而rbegin()和rend(),加了r后刚刚反过来了,rbegin()指向str的最后一个元素,rend()指向第一个元素还要往前一位. 第二…
题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536 题意:给定n1.n2两个数,求可以是两者相等的进制:如果没有,输出Impossible 思路: ①暴力枚举进制数,超时/wa,错在样例7,这样写最多只能有24分. 盲猜样例7应该是这样的 input: output: ②开二分搜索进制数,转换出来的数会爆long long,所以二分的check要修改一下. 当要求的数只有一位时,不管是多…
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…
题目 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…
改了一天也没明白,第7个数据是怎么卡的 #include <bits/stdc++.h> using namespace std; const int maxn=1005; typedef long long ll; ll tonum(char c) { if (c>='0'&&c<='9') { return c-'0'; } return c-'a'+10; } long long tran(string s,ll base) { int len=s.lengt…
题意: 输入两个数可能包含小写字母,1或者2,进制大小.第三个数为代表第一个数是第四个数进制的,求第二个数等于第一个数时进制的大小,不可能则输出Impossible,第三个数为2代表第二个数是第四个数进制的,求第一个数等于第二个数时进制的大小,不可能则输出Impossible.数字的位数最多是十位. trick: 进制可能很大,所以运算过程中可能会爆long long,不必担心,当成负数处理即可. AAAAAccepted code: #include<bits/stdc++.h> using…
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 i…
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…
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 N1 and N2, your task i…