/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 92ms 11.59 MiB
#2 Accepted 89ms 11.223 MiB
#3 Accepted 88ms 10.938 MiB
#4 Accepted 89ms 11.293 MiB
#5 Accepted 89ms 11.309 MiB
#6 Accepted 89ms 11.234 MiB

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-05 15:00:04
Judged By
Score
100
Total Time
92ms
Peak Memory
11.59 MiB