【墨奇科技】
给定两个以字符串形式表示的非负整数num 1和num 2, 返回num 1除以num 2的整数商quotient和余数remainder。
两个输入num 1和num 2均为字符串格式, 长度不超过100个字符, 只由数字0~9构成, 除非表示数字0, 否则均不会以字符’0’开头, 其中num 2不会为’0’, 两个输出quotient和remainder也都为字符串格式。
例如:输入num 1=“11”和num 2=“4”。应输出"2, 3”。
package com.dove;
/**
* <p>The following is a class description.</p>
*
* @author Guo S.Y.
* @version V1.0
* @since 2022/7/31
*/
public class Demo{
public boolean Compare(String first, String second) {
int len1 = first.length();
int len2 = second.length();
if (len1 < len2) {
return false;
} else {
return len1 != len2 || first.charAt(0) >= second.charAt(0);
}
}
public String sub(String num1, String num2) {
boolean fushu = false;
if (num1.length() < num2.length()) {
String temp = num1;
num1 = num2;
num2 = temp;
fushu = true;
} else if (num1.length() == num2.length()