Accepted
Code
import java.util.Scanner;
public class Main {
static Scanner in = new Scanner(System.in);
static int h, w;
static void solve() {
long sum = 0L;
for(int i = 1; i <= Math.min(w, h); ++i) {
sum += (h - i + 1) * (w - i + 1);
}
System.out.println(sum);
}
public static void main(String args[]) {
input();
solve();
}
private static void input() {
h = in.nextInt();
w = in.nextInt();
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1121 Square Counting Challenge
- Contest
- Brain Booster #7
- Language
- Java 8 (OpenJDK 1.8.0_422)
- Submit At
- 2024-11-05 15:00:04
- Judged At
- 2024-11-11 02:31:51
- Judged By
- Score
- 100
- Total Time
- 133ms
- Peak Memory
- 15.609 MiB