結果

問題 No.1883 SLASH
ユーザー ks2mks2m
提出日時 2022-03-25 22:43:50
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 2,356 ms
コンパイル使用メモリ 74,896 KB
実行使用メモリ 41,464 KB
最終ジャッジ日時 2024-04-22 07:27:34
合計ジャッジ時間 5,037 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,444 KB
testcase_01 AC 129 ms
41,072 KB
testcase_02 AC 127 ms
41,348 KB
testcase_03 AC 131 ms
41,156 KB
testcase_04 AC 131 ms
41,328 KB
testcase_05 AC 132 ms
41,256 KB
testcase_06 AC 129 ms
41,144 KB
testcase_07 AC 128 ms
41,320 KB
testcase_08 AC 128 ms
41,424 KB
testcase_09 AC 128 ms
41,028 KB
testcase_10 AC 127 ms
41,300 KB
testcase_11 AC 129 ms
41,464 KB
testcase_12 AC 129 ms
41,332 KB
testcase_13 AC 129 ms
41,176 KB
testcase_14 AC 127 ms
41,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		sc.close();

		int max = 0;
		int min = 9;
		for (int i = 0; i < s.length; i++) {
			max = Math.max(max, s[i] - '0');
			min = Math.min(min, s[i] - '0');
		}
		System.out.println(max - min);
	}
}
0