結果

問題 No.2239 Friday
ユーザー AsahiAsahi
提出日時 2023-03-10 21:32:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 5,893 bytes
コンパイル時間 7,805 ms
コンパイル使用メモリ 96,300 KB
実行使用メモリ 57,760 KB
最終ジャッジ日時 2023-10-18 07:13:38
合計ジャッジ時間 7,894 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,340 KB
testcase_01 AC 128 ms
57,580 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 129 ms
57,688 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 127 ms
55,680 KB
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;
import java.util.regex.Pattern;

class Main{


    static void solve(){

        int a = ni(), b = ni();
        int sum = a + b;
        if(a == b) output.print(0);
        else output.println(Math.min(sum-a,sum-b));
    }

    /* 関数 */

    

    /* 定数 */

    static PrintWriter output;
    static Scanner sc;
    static int  Inf = 1010101010; 
    static long Lnf = (long)1e18;
    static final long mod = 1000000007;
    static final long MOD = 998244353 ;

    /* 長いやつ  */

    static String cut(String S , int start, int end) { return S.substring(start,end);}
    static char cut(String S , int start) { return S.charAt(start);}
    static String tos(int val) { return Integer.toString(val);}
    static String tos(long val) { return Long.toString(val);}
    static int toi(String S) { return Integer.parseInt(S);}
    static long tol(String S) { return Long.parseLong(S);}

    /* 実装が面倒なやつ */

    public static long factorial(long n){
        return n <= 0 ? 1 : n * factorial(n-1);
    }

    public static int digits(long n) {
        return String.valueOf(n).length();
    }

    static boolean kaibun(String S) {
        StringBuilder s = new StringBuilder();
        s.append(S);
        return s.reverse().toString().equals(S);
    }

    static boolean isNumber(String value) {
        boolean result = false;
        if (value != null) {
            Pattern pattern = Pattern.compile("^[0-9]+$|-[0-9]+$");
            result = pattern.matcher(value).matches();
        }
        return result;
    }

    static Map<Integer,Integer> counter(int [] A) {
        HashMap<Integer,Integer> count = new HashMap<>();
        for(int i=0;i<A.length;i++) {
            if(!count.containsKey(A[i])) count.put(A[i],1);
            else count.put(A[i],count.get(A[i])+1);
        }
        return count;
    }

    static Map<Long,Integer> counter(long [] A) {
        HashMap<Long,Integer> count = new HashMap<>();
        for(int i=0;i<A.length;i++) {
            if(!count.containsKey(A[i])) count.put(A[i],1);
            else count.put(A[i],count.get(A[i])+1);
        }
        return count;
    }

    /*入出力端折るやつ*/

    static int ni(){ return Integer.parseInt(sc.next());}
    static long nl(){ return Long.parseLong(sc.next());}
    static double nd(){ return Double.parseDouble(sc.next());}
    static String ns(){ return sc.next();}
    static BigInteger bi(){ return sc.nextBigInteger();}
    static BigDecimal bd(){ return sc.nextBigDecimal();}
    
    static int [] IntArray(int n) {
        int [] Array = new int[n];
        for(int i=0;i<n;i++) Array[i] = ni();
        return Array;
    }
    static int [][] IntArray(int n , int m) {
        int [][] Array = new int[n][m];
        for(int i=0;i<n;i++) for(int j=0;j<m;j++) Array[i][j] = ni();
        return Array;
    }
    static long [] LongArray(int n) {
        long [] Array = new long[n];
        for(int i=0;i<n;i++) Array[i] = nl();
        return Array;
    }
    static long [][] LongArray(int n , int m) {
        long [][] Array = new long[n][m];
        for(int i=0;i<n;i++) for(int j=0;j<m;j++) Array[i][j] = nl();
        return Array;
    }
    static double [] DoubleArray(int n) {
        double [] Array = new double[n];
        for(int i=0;i<n;i++) Array[i] = nd();
        return Array;
    }
    static double [][] DoubleArray(int n , int m) {
        double [][] Array = new double[n][m];
        for(int i=0;i<n;i++) for(int j=0;j<m;j++) Array[i][j] = nd();
        return Array;
    }
    static String [] StringArray(int n) {
        String [] Array = new String[n];
        for(int i=0;i<n;i++) Array[i] = ns();
        return Array;
    }
    static String [][] StringArray(int n , int m) {
        String [][] Array = new String[n][m];
        for(int i=0;i<n;i++) for(int j=0;j<m;j++) Array[i][j] = ns();
        return Array;
    }
    static char [] CharArray(int n) {
        char [] Array = new char[n];
        String S = ns();
        for(int i=0;i<n;i++) Array[i] = S.charAt(i);
        return Array;
    }
    static char [][] CharArray(int n,int m) {
        char [][] Array = new char[n][m];
        for(int i=0;i<n;i++) {
            String S = ns();
            for(int j=0;j<m;j++) Array[i][j] = S.charAt(j);
        }
        return Array;
    }
    static void PrintArray(int [] A) {
        for(int i=0;i<A.length;i++) output.print(A[i]+" ");
        output.println();
    }
    static void PrintArray(long [] A) {
        for(int i=0;i<A.length;i++) output.print(A[i]+" ");
        output.println();
    }
    static void PrintArray(double [] A) {
        for(int i=0;i<A.length;i++) output.print(A[i]+" ");
        output.println();
    }
    static void PrintArray(boolean [] A) {
        for(int i=0;i<A.length;i++) output.print(A[i]+" ");
        output.println();
    }
    static void PrintArray(int [][] A) {
        for(int i=0;i<A.length;i++) {
            for(int j=0;j<A[i].length;j++) {
                if(A[i][j] == Inf) output.print("X ");
                else output.print(A[i][j]+" ");
            }
            output.println();
        }
    }
    static void PrintArray(long [][] A) {
        for(int i=0;i<A.length;i++) {
            for(int j=0;j<A[i].length;j++) {
                if(A[i][j] == Lnf) output.print("X ");
                else output.print(A[i][j]+" ");
            }
            output.println();
        }
    }
    static void PrintArray(boolean [][] A) {
        for(int i=0;i<A.length;i++) {
            for(int j=0;j<A[i].length;j++) {
                output.print(A[i][j]?"O":"X");
            }
            output.println();
        }
    }
    public static void main(String[] args){
        output = new PrintWriter(System.out);
        sc = new Scanner(System.in);
        solve();
        output.flush();
    }
}

0