結果

問題 No.1883 SLASH
ユーザー tentententen
提出日時 2022-04-02 16:35:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,109 bytes
コンパイル時間 2,452 ms
コンパイル使用メモリ 74,820 KB
実行使用メモリ 37,376 KB
最終ジャッジ日時 2024-05-01 12:52:40
合計ジャッジ時間 4,157 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
37,088 KB
testcase_01 AC 52 ms
37,376 KB
testcase_02 AC 54 ms
37,152 KB
testcase_03 AC 52 ms
37,228 KB
testcase_04 AC 54 ms
37,060 KB
testcase_05 AC 56 ms
37,144 KB
testcase_06 AC 53 ms
37,092 KB
testcase_07 AC 53 ms
37,120 KB
testcase_08 AC 53 ms
36,892 KB
testcase_09 AC 52 ms
37,096 KB
testcase_10 AC 54 ms
36,776 KB
testcase_11 AC 53 ms
37,080 KB
testcase_12 AC 53 ms
37,052 KB
testcase_13 AC 53 ms
36,972 KB
testcase_14 AC 53 ms
36,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int min = Integer.MAX_VALUE;
        int max = 0;
        for (char c : sc.next().toCharArray()) {
            int x = c - '0';
            min = Math.min(min, x);
            max = Math.max(max, x);
        }
        System.out.println(max - min);
    }
}


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