結果
| 問題 |
No.725 木は明らかに森である
|
| コンテスト | |
| ユーザー |
hiyori
|
| 提出日時 | 2019-02-08 18:41:54 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 812 bytes |
| コンパイル時間 | 522 ms |
| コンパイル使用メモリ | 66,616 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 14:26:14 |
| 合計ジャッジ時間 | 1,110 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 3 |
ソースコード
#include<iostream>
#include<stdlib.h>
#include<string>
using namespace std;
void run();
void change_forest(string s, string sub_str);
int main()
{
run();
return EXIT_SUCCESS;
}
void run()
{
string s,sub_str="treeone";
cin>>s;
if(s.length()<sub_str.length()){
cout<<s<<endl;
}
else{
change_forest(s,sub_str);
}
}
void change_forest(string s, string sub_str)
{
int sub_l = sub_str.length();
for(int i=0;i<s.length();i++){
if(s[i]==sub_str[0]){
for(int j=1;j<sub_l;j++){
if(s[i+j]!=sub_str[j]){break;}
else if(j==sub_l-1&&s[i+j]==sub_str[j]){
s.replace(i,sub_l,"forest");
//cout<<s<<endl;
i+=6;
}
}
}
}
cout<<s<<endl;
}
hiyori