PAT 1010 Radix (二分)】的更多相关文章

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…
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…
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…
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…
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 \(N_1\) and \(N_2…
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…
PAT甲级1010. Radix (25) 题意: 给定一对正整数,例如6和110,这个等式6 = 110可以是真的吗?答案是"是",如果6是十进制数,110是二进制数. 现在对于任何一对正整数N1和N2,你的任务是找到一个数字的基数,而另一个数字的基数. 输入规格: 每个输入文件包含一个测试用例.每个案例占用一个包含4个正整数的行: N1 N2标签基数 这里N1和N2每个不超过10位数.数字小于其基数,并从集合{0-9,a-z}中选择,其中0-9表示十进制数0-9,a-z表示十进制数…
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) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 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…
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的…
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) 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…
1010 Radix 注意点 如111 1 1 10类似情况下,若n为个位数,如果本身比另一个数小,则多少的进制都是没有用的(可能会造成空循环而超时),不过好像没有这么一个测试用例 进制应该比最少数据中的最大的数要大一,如8最少是9进制的数,z最少是36进制的数 注意算法中的超时问题如9999999999 11 1 10很容易超时,注意匹配的算法 如果用c等强类型语言写,注意溢出问题,int类型肯定是不够的 python3代码 def getNum(num, radix): sum = 0 co…
题意: 输入两个数可能包含小写字母,1或者2,进制大小.第三个数为代表第一个数是第四个数进制的,求第二个数等于第一个数时进制的大小,不可能则输出Impossible,第三个数为2代表第二个数是第四个数进制的,求第一个数等于第二个数时进制的大小,不可能则输出Impossible.数字的位数最多是十位. trick: 进制可能很大,所以运算过程中可能会爆long long,不必担心,当成负数处理即可. AAAAAccepted code: #include<bits/stdc++.h> using…
撸完这题,感觉被掏空. 由于进制可能大的飞起..所以需要开longlong存,答案可以二分得到. 进制很大,导致转换成10进制的时候可能爆long long,在二分的时候,如果溢出了,那么上界=mid-1 #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<cstdio> using namespace std; ],t[]; int…
题目 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 N1 and N2, your task is to find the rad…
https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536 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 fo…
题意:给出n1和n2,以及其中一个数的进制,问另一个数是多少进制的情况下,才会是两个数相等.不存在的话,则输出Impossible 这题思路很简单,但是要考虑的比较多,在简单题里面算是比较好的. 有两个注意点1.我被题目给骗了!!!以为最大进制只可能是36,所以在程序里就枚举2~36的进制,导致错了一大片样例最小进制下界low当然是n2的最大数字位+1最大进制上界high题目没有给出说明,但最大只可能为n1(前提n1>=low).为啥不会超过n1呢,比如40 10 1 10很明显10是进制表示除…
Radix 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 th…
Prince and Princess Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 150    Accepted Submission(s): 46 Problem Description There are n princes and m princesses. Princess can marry any prince. But…
题目: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 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 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 N​1​​ and N​2​​, your task is to find the radi…
1010 一元多项式求导 (25)(25 分)提问 设计函数求一元多项式的导数.(注:x^n^(n为整数)的一阶导数为n*x^n-1^.) 输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过1000的整数).数字间以空格分隔. 输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数.数字间以空格分隔,但结尾不能有多余空格.注意"零多项式"的指数和系数都是0,但是表示为"0 0". 输入样例: 3 4 -5 2 6 1 -2 0 输出样例: 1…
problem 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…
思路: 最后发现对当前列车比我大的编号的栈有没有就好了,所以开个vector存一下,然后二分一下vector找一下第一个比我大的数就好了 #include <bits/stdc++.h> using namespace std; typedef long long LL; const int N=1e5+10; int n,a[N]; vector<int>q; int main() { scanf("%d",&n); for(int i=0;i<…