結果
問題 | No.52 よくある文字列の問題 |
ユーザー |
![]() |
提出日時 | 2014-10-30 00:10:54 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 1,892 ms |
コンパイル使用メモリ | 160,748 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 01:28:18 |
合計ジャッジ時間 | 2,504 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.typecons, std.range, std.datetime; void main(){ string s; readf("%s\n", &s); auto res = dfs(s).sort.uniq.array.length; res.writeln; } string[] dfs(const string s, string[] acc = [""]){ if(s.length == 0){ return acc; } auto front = dfs( s[1..$], acc.map!(e => e ~ s[0]).array ); auto back = dfs( s[0..$-1], acc.map!(e => e ~ s[$-1]).array ); return front ~ back; }