結果
問題 |
No.725 木は明らかに森である
|
ユーザー |
![]() |
提出日時 | 2025-08-15 00:43:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 1,072 ms |
コンパイル使用メモリ | 115,920 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-15 00:43:28 |
合計ジャッジ時間 | 1,937 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
#include <iostream> #include <sstream> #include <string> #include <regex> using namespace std; bool ReplaceOnce(std::string& s, const std::string& origin, const std::string& dest) { if (origin.empty()) return false; std::size_t pos = s.find(origin); if (pos == std::string::npos) return false; s.replace(pos, origin.size(), dest); return true; } int main() { string s; cin >> s; for (int _ = 0; _ < 25; _++) { ReplaceOnce(s, "treeone", "$"); } for (int _ = 0; _ < 25; _++) { ReplaceOnce(s, "$", "forest"); } cout << s << endl; }