結果

問題 No.725 木は明らかに森である
ユーザー soragsorag
提出日時 2022-08-06 11:17:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 74,280 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-14 12:44:37
合計ジャッジ時間 1,321 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,368 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,372 KB
testcase_07 WA -
testcase_08 AC 1 ms
4,372 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:27:44: 警告: NULL から非ポインタ型 ‘__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type’ {aka ‘char’} へ変換しています [-Wconversion-null]
   27 |                                 s[i + 6] = NULL;
      |                                            ^~~~

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#define all(x) x.begin(),x.end()
#define pb push_back
#define ll long long 
#define P pair<int,int>
#define LP pair<ll,ll>
using namespace std;
int main() {
	string s;
	cin >> s;
	if (s.length() > 6) {
		for (int i = 0; i < s.length() - 6; i++) {
			if (s[i] == 't' and s[i + 1] == 'r' and s[i + 2] == 'e'
				and s[i + 3] == 'e' and s[i + 4] == 'o' and s[i + 5] == 'n'
				and s[i + 6] == 'e') {
				s[i] = 'f';
				s[i + 1] = 'o';
				s[i + 2] = 'r';
				s[i + 3] = 'e';
				s[i + 4] = 's';
				s[i + 5] = 't';
				s[i + 6] = NULL;
			}
		}
	}
	cout << s << endl;
	return 0;
}



0