結果

問題 No.3240 Count 8 Included Numbers (Easy)
ユーザー Maeda
提出日時 2025-08-26 11:39:01
言語 Java
(openjdk 23)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 76,540 KB
実行使用メモリ 46,728 KB
最終ジャッジ日時 2025-08-26 11:39:07
合計ジャッジ時間 5,534 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int count = 0;
		for(int i = 1 ; i <= n ; i++){
			String str = String.valueOf(i);
			if( str.indexOf('8') != -1){
				count++; 
			}
		}
		System.out.println(count);
    }
}
0