結果
問題 |
No.725 木は明らかに森である
|
ユーザー |
|
提出日時 | 2025-03-12 10:51:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 755 ms |
コンパイル使用メモリ | 69,096 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-12 10:51:59 |
合計ジャッジ時間 | 1,599 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
#include<iostream> #include<cassert> #define rep(i,n) for(i=0;i<(int)(n);i++) using namespace std; typedef long long ll; typedef unsigned long long ull; string s; const string t="treeone",tt="forest"; int main(){ int i,j; string ans=""; cin>>s; auto judge=[&](int head)->bool{ int i; rep(i,t.length())if(s[head+i]!=t[i])return false; return true; }; i=0; while(i<s.length()){ if(i+t.length()-1<s.length()&&judge(i))ans+=tt,i+=t.length(); else ans+=s[i++]; } printf("%s\n",ans.c_str()); return 0; }