結果

問題 No.3316 Make 81181819 with only 0,1,or 8
コンテスト
ユーザー msksknkn
提出日時 2025-10-31 21:25:27
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 964 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,536 ms
コンパイル使用メモリ 89,212 KB
実行使用メモリ 452,680 KB
最終ジャッジ日時 2025-10-31 21:25:43
合計ジャッジ時間 15,695 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 1 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package q1;
import java.util.*;

public class Main {
	public static TreeSet<Integer> set = new TreeSet<>();
	public static int iwai = 81181819;
	public static int[] ans = new int[iwai];
	public static boolean[] vis = new boolean[iwai];
	public static HashMap<Integer,String> map = new HashMap<>();
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		make(0);
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < t;i++) {
			int n = sc.nextInt();
			int rem = iwai - n;
			int ans = 0;
			StringBuilder a = new StringBuilder();
			while(rem > 0) {
				int f = set.floor(rem);
				ans++;
				a.append(f + "\n");
				rem -= f;
			}sb.append(ans + "\n" + a);
		}
		System.out.print(sb);
	}public static void make(int a) {
		if(a > iwai) {
			return;
		}
		if(a != 0) {
			set.add(a);
			make(a * 10);
		}make(a * 10 + 1);
		make(a * 10 + 8);
	}

}
0