This commit is contained in:
xixu-me committed 2024-05-24 22:13:32 +08:00
1 parent 70ffe81142
commit 29591a5f9d
21 files changed
+17 -12

No files matched your search

@@ -20,7 +20,7 @@ public class DateCalculation {
System.out.println(ans);
}
public static boolean isLeapYear(int year) {
static boolean isLeapYear(int year) {
return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
}
}
+1 -1
View File
@@ -30,4 +30,4 @@ public class PrimeNumbers {
}
return true;
}
}
}
@@ -9,7 +9,7 @@ public class SecurePasswordSpecification {
System.out.println(isSafePassword(s) ? "success" : "fail");
}
private static boolean isSafePassword(String password) {
static boolean isSafePassword(String password) {
if (password.length() < 6 || password.length() > 12)
return false;
boolean haveLower = false, hasUpper = false, haveDigit = false, hasWhitespace = false;
@@ -25,4 +25,4 @@ public class SecurePasswordSpecification {
}
return haveLower && hasUpper && haveDigit && !hasWhitespace;
}
}
}
@@ -3,7 +3,14 @@ package finalexam.StandardIO;
import java.util.Scanner;
public class SumInReverseOrder {
private static int reverse(int n) {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n1 = sc.nextInt();
int n2 = sc.nextInt();
System.out.println(reverse(n1) + reverse(n2));
}
static int reverse(int n) {
int rev = 0;
while (n > 0) {
rev = rev * 10 + n % 10;
@@ -11,11 +18,4 @@ public class SumInReverseOrder {
}
return rev;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n1 = sc.nextInt();
int n2 = sc.nextInt();
System.out.println(reverse(n1) + reverse(n2));
}
}