結果

問題 No.1883 SLASH
ユーザー ks2m
提出日時 2022-03-25 22:43:50
言語 Java
(openjdk 23)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 2,744 ms
コンパイル使用メモリ 75,108 KB
実行使用メモリ 54,136 KB
最終ジャッジ日時 2024-10-14 06:42:19
合計ジャッジ時間 5,124 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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