摘要: 思路是模拟从低位到高位的按位相加,需要考虑进位 public String addStrings(String num1, String num2) { int bitLen1 = num1.length() - 1, bitLen2 = num2.length() - 1; StringBuild 阅读全文
posted @ 2024-07-27 20:23 YaosGHC 阅读(2) 评论(0) 推荐(0) 编辑
摘要: public boolean checkPerfectNumber(int num) { int sum = 0; for (int i = 1; i <= num / 2; i++) if (num % i == 0) sum += i; return sum == num; } 阅读全文
posted @ 2024-07-27 19:47 YaosGHC 阅读(6) 评论(0) 推荐(0) 编辑