結果
| 問題 | No.2043 Ohuton and Makura |
| コンテスト | |
| ユーザー |
merlin
|
| 提出日時 | 2022-08-19 22:01:43 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 71 ms / 2,000 ms |
| + 232µs | |
| コード長 | 985 bytes |
| 記録 | |
| コンパイル時間 | 1,592 ms |
| コンパイル使用メモリ | 85,268 KB |
| 実行使用メモリ | 41,288 KB |
| 最終ジャッジ日時 | 2026-09-11 22:52:21 |
| 合計ジャッジ時間 | 3,757 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
import java.io.*;
import java.util.*;
class Main
{
public static void main(String args[])throws Exception
{
BufferedReader bu=new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
String s[]=bu.readLine().split(" ");
int n=Integer.parseInt(s[0]),m=Integer.parseInt(s[1]),area=Integer.parseInt(s[2]);
long ans=0;
for(int i=1;i<=area;i++)
{
long hor=n+1-i; //number of rows where we can place this
if(hor<=0) break;
//we need to multiply this with m+1-1 + m+1-2 + m+1-3 + ...+ m+1-breadth (consider only +ve values)
//we need to make sure the cells covd is less area, so consider breadth
int breadth=area/i, right=Math.max(0,m-breadth);
long vsum=sum(m)-sum(right);
ans+=hor*vsum;
}
System.out.println(ans);
}
static long sum(int n)
{
return 1l*n*(n+1)/2;
}
}
merlin