結果

問題 No.72 そろばん Med
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-20 16:24:34
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 595 bytes
コンパイル時間 2,616 ms
コンパイル使用メモリ 71,592 KB
実行使用メモリ 57,540 KB
最終ジャッジ日時 2023-08-24 23:19:30
合計ジャッジ時間 7,563 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,960 KB
testcase_01 AC 119 ms
56,012 KB
testcase_02 AC 119 ms
55,832 KB
testcase_03 AC 120 ms
56,036 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 120 ms
56,084 KB
testcase_07 AC 119 ms
55,952 KB
testcase_08 AC 120 ms
56,288 KB
testcase_09 AC 118 ms
55,816 KB
testcase_10 AC 120 ms
55,952 KB
testcase_11 AC 120 ms
55,520 KB
testcase_12 AC 122 ms
55,440 KB
testcase_13 AC 121 ms
55,940 KB
testcase_14 AC 119 ms
56,096 KB
testcase_15 AC 118 ms
55,580 KB
testcase_16 AC 119 ms
55,864 KB
testcase_17 AC 120 ms
56,000 KB
testcase_18 AC 120 ms
56,004 KB
testcase_19 AC 121 ms
57,540 KB
testcase_20 AC 120 ms
55,848 KB
testcase_21 AC 121 ms
55,684 KB
testcase_22 AC 122 ms
56,056 KB
testcase_23 AC 122 ms
55,856 KB
testcase_24 AC 122 ms
56,252 KB
testcase_25 AC 122 ms
56,008 KB
testcase_26 AC 123 ms
56,468 KB
権限があれば一括ダウンロードができます

ソースコード

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 b = n*a;
            b=b%1000007;
            long c = a*a;
            c=c%1000007;
            long ans = (b-c+n);
            System.out.println((long)ans);
        }
    }
    
}
0