結果

問題 No.84 悪の算盤
ユーザー chiho_miyakochiho_miyako
提出日時 2015-04-06 10:19:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 495 bytes
コンパイル時間 2,654 ms
コンパイル使用メモリ 75,384 KB
実行使用メモリ 41,656 KB
最終ジャッジ日時 2024-04-21 10:01:28
合計ジャッジ時間 3,906 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
41,388 KB
testcase_01 AC 107 ms
40,168 KB
testcase_02 AC 116 ms
41,336 KB
testcase_03 AC 113 ms
41,112 KB
testcase_04 AC 115 ms
40,920 KB
testcase_05 AC 117 ms
41,128 KB
testcase_06 AC 114 ms
41,404 KB
testcase_07 AC 114 ms
41,256 KB
testcase_08 AC 118 ms
41,328 KB
testcase_09 AC 114 ms
41,396 KB
testcase_10 AC 103 ms
40,164 KB
testcase_11 AC 102 ms
40,068 KB
testcase_12 AC 113 ms
41,656 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