結果

問題 No.84 悪の算盤
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-06 10:19:43
言語 Java19
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 495 bytes
コンパイル時間 2,074 ms
コンパイル使用メモリ 71,748 KB
実行使用メモリ 56,248 KB
最終ジャッジ日時 2023-08-03 12:05:41
合計ジャッジ時間 4,449 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,724 KB
testcase_01 AC 123 ms
55,984 KB
testcase_02 AC 123 ms
53,756 KB
testcase_03 AC 124 ms
56,084 KB
testcase_04 AC 125 ms
55,708 KB
testcase_05 AC 124 ms
55,468 KB
testcase_06 AC 121 ms
55,856 KB
testcase_07 AC 125 ms
55,812 KB
testcase_08 AC 126 ms
55,768 KB
testcase_09 AC 125 ms
55,700 KB
testcase_10 AC 125 ms
56,248 KB
testcase_11 AC 125 ms
55,712 KB
testcase_12 AC 127 ms
56,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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