結果
問題 | No.111 あばばばば |
ユーザー |
![]() |
提出日時 | 2021-02-09 11:20:45 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 114 ms / 5,000 ms |
コード長 | 446 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 74,276 KB |
実行使用メモリ | 54,220 KB |
最終ジャッジ日時 | 2024-07-06 16:24:03 |
合計ジャッジ時間 | 3,809 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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); } }