結果

問題 No.1860 Magnets
ユーザー tentententen
提出日時 2022-03-07 09:46:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,032 bytes
コンパイル時間 2,942 ms
コンパイル使用メモリ 71,860 KB
実行使用メモリ 51,360 KB
最終ジャッジ日時 2023-09-29 07:47:09
合計ジャッジ時間 5,078 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,348 KB
testcase_01 AC 41 ms
49,228 KB
testcase_02 AC 41 ms
49,452 KB
testcase_03 AC 40 ms
49,220 KB
testcase_04 AC 40 ms
49,316 KB
testcase_05 AC 40 ms
49,456 KB
testcase_06 AC 40 ms
49,420 KB
testcase_07 AC 40 ms
49,320 KB
testcase_08 AC 39 ms
49,640 KB
testcase_09 AC 40 ms
49,824 KB
testcase_10 AC 40 ms
49,620 KB
testcase_11 AC 41 ms
49,340 KB
testcase_12 AC 42 ms
47,904 KB
testcase_13 AC 43 ms
49,328 KB
testcase_14 AC 41 ms
49,368 KB
testcase_15 AC 41 ms
49,584 KB
testcase_16 AC 40 ms
49,516 KB
testcase_17 AC 39 ms
49,340 KB
testcase_18 AC 40 ms
49,224 KB
testcase_19 AC 40 ms
49,728 KB
testcase_20 AC 40 ms
49,360 KB
testcase_21 AC 40 ms
49,664 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 42 ms
49,356 KB
testcase_26 AC 42 ms
49,436 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        long a = sc.nextInt();
        long b = sc.nextInt();
        long ans = a * 2 + b * 2 - 2 - 1;
        ans -= Math.min(a - 1, b - 1) * 2;
        System.out.println(ans);
    }
}


class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0