結果
| 問題 |
No.3316 Make 81181819 with only 0,1,or 8
|
| コンテスト | |
| ユーザー |
msksknkn
|
| 提出日時 | 2025-10-31 21:11:23 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 874 bytes |
| コンパイル時間 | 6,479 ms |
| コンパイル使用メモリ | 88,072 KB |
| 実行使用メモリ | 53,864 KB |
| 最終ジャッジ日時 | 2025-10-31 21:11:39 |
| 合計ジャッジ時間 | 15,064 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 21 |
ソースコード
package q1;
import java.util.*;
public class Main {
public static TreeSet<Integer> set = new TreeSet<>();
public static int iwai = 81181819;
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
StringBuilder sb = new StringBuilder();
make(0);
//System.out.println(set);
while(t > 0) {
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");
//System.out.println(f + " " + rem);
rem -= f;
}sb.append(ans + "\n" + a);
t--;
}System.out.print(sb);
}public static void make(int a) {
if(a * 10 > iwai) {
return;
}set.add(a);
if(a != 0) {
make(a * 10);
}make(a * 10 + 1);
make(a * 10 + 8);
}
}
msksknkn