結果

問題 No.71 そろばん
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-20 13:03:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 391 bytes
コンパイル時間 2,061 ms
コンパイル使用メモリ 71,508 KB
実行使用メモリ 56,356 KB
最終ジャッジ日時 2023-09-18 00:50:31
合計ジャッジ時間 5,801 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,892 KB
testcase_01 AC 125 ms
55,644 KB
testcase_02 AC 124 ms
56,172 KB
testcase_03 AC 125 ms
56,052 KB
testcase_04 AC 122 ms
55,956 KB
testcase_05 AC 120 ms
55,956 KB
testcase_06 WA -
testcase_07 AC 120 ms
55,712 KB
testcase_08 WA -
testcase_09 AC 123 ms
56,004 KB
testcase_10 AC 122 ms
56,356 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 123 ms
55,392 KB
testcase_17 WA -
testcase_18 AC 123 ms
55,876 KB
testcase_19 AC 122 ms
55,928 KB
testcase_20 AC 126 ms
55,884 KB
testcase_21 AC 124 ms
55,848 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int n = koko.nextInt();
        if(n%2==0){
            int a = n/2;
            System.out.println((long)n*n/4+n);
        }else{
            int a = (n+1)/2;
            System.out.println((long)-a*a+n*a+n);
        }
    }
    
}
0