結果
| 問題 |
No.1185 完全な3の倍数
|
| コンテスト | |
| ユーザー |
kokatsu
|
| 提出日時 | 2022-10-11 23:15:47 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 408 ms / 2,000 ms |
| コード長 | 426 bytes |
| コンパイル時間 | 2,257 ms |
| コンパイル使用メモリ | 206,528 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 16:22:20 |
| 合計ジャッジ時間 | 10,661 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
import std;
void main() {
long N;
readf("%d\n", N);
string digs = "0369";
long res = min(100, N) / 3 - 3;
void f(string s) {
foreach (d; digs) {
string t = s ~ d.to!string;
if (t.to!long <= N) {
if (t.length > 2) ++res;
f(t);
}
}
}
foreach (i; 1 .. 4) {
f(digs[i].to!string);
}
res.writeln;
}
kokatsu