/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 125ms 15.609 MiB
#2 Accepted 123ms 15.113 MiB
#3 Accepted 129ms 15.277 MiB
#4 Accepted 133ms 15.168 MiB
#5 Accepted 128ms 15.012 MiB
#6 Accepted 129ms 15.09 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-11 02:31:51
Judged By
Score
100
Total Time
133ms
Peak Memory
15.609 MiB