結果

問題 No.72 そろばん Med
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-20 16:19:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 1,878 ms
コンパイル使用メモリ 71,176 KB
実行使用メモリ 58,160 KB
最終ジャッジ日時 2023-09-18 01:16:36
合計ジャッジ時間 6,505 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,080 KB
testcase_01 AC 123 ms
55,940 KB
testcase_02 AC 125 ms
55,596 KB
testcase_03 AC 123 ms
55,832 KB
testcase_04 AC 123 ms
55,656 KB
testcase_05 WA -
testcase_06 AC 123 ms
55,780 KB
testcase_07 AC 123 ms
55,444 KB
testcase_08 WA -
testcase_09 AC 123 ms
55,880 KB
testcase_10 AC 125 ms
55,380 KB
testcase_11 AC 124 ms
55,700 KB
testcase_12 AC 125 ms
55,432 KB
testcase_13 WA -
testcase_14 AC 124 ms
55,596 KB
testcase_15 AC 126 ms
55,780 KB
testcase_16 AC 124 ms
56,408 KB
testcase_17 AC 124 ms
55,784 KB
testcase_18 AC 123 ms
55,928 KB
testcase_19 AC 132 ms
55,900 KB
testcase_20 AC 122 ms
55,708 KB
testcase_21 AC 127 ms
55,912 KB
testcase_22 WA -
testcase_23 AC 122 ms
55,940 KB
testcase_24 AC 122 ms
55,660 KB
testcase_25 AC 121 ms
55,900 KB
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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