結果
| 問題 | No.111 あばばばば |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2021-02-09 11:20:45 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 5,000 ms |
| コード長 | 446 bytes |
| 記録 | |
| コンパイル時間 | 2,409 ms |
| コンパイル使用メモリ | 81,020 KB |
| 実行使用メモリ | 41,572 KB |
| 最終ジャッジ日時 | 2026-03-28 06:20:15 |
| 合計ジャッジ時間 | 5,885 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long ans;
if (n % 2 == 0) {
long base = (n - 2) / 2;
ans = (1 + base) * base;
} else {
long base = (n - 2) / 2;
ans = (1 + base) * base;
ans += n / 2;
}
System.out.println(ans);
}
}
tenten