n2

1010 Radix (25 分)

ε祈祈猫儿з 提交于 2019-11-26 19:36:04
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 is to find the radix of one number while that of the other is given. Input Specification: Each input file contains one test case. Each case occupies a line which contains 4 positive integers: N1 N2 tag radix Here N1 and N2 each has no more than 10 digits. A digit is less than its radix and is chosen from the set { 0-9, a - z } where 0-9

【PAT甲级 U形打印】1031 Hello World for U (20 分) Java版 6/6通过

淺唱寂寞╮ 提交于 2019-11-25 19:46:14
题目 一开始没看懂“ as squared as possible ”和那个max不等式到底是什么意思,看了别人的解答才明白: 如果n % 3 == 0,n正好被3整除,直接n1 = n2 = n3 如果n % 3 == 1,因为n2要比n1大,所以把多出来的那1个给n2 如果n % 3 == 2,就把多出来的那2个给n2 题解 import java . util . Scanner ; public class Main { public static void main ( String [ ] args ) { String str = new Scanner ( System . in ) . nextLine ( ) ; Spuare s = new Spuare ( str ) ; s . print ( ) ; } } class Spuare { String str ; int len ; // 总长 int n1 ; // 左 int n2 ; // 下 int n3 ; // 右 // 如果n % 3 == 0,n正好被3整除,直接n1 = n2 = n3 // 如果n % 3 == 1,因为n2要比n1大,所以把多出来的那1个给n2 // 如果n % 3 == 2,就把多出来的那2个给n2 public Spuare ( String str ) {