結果

問題 No.1020 Reverse
ユーザー IchimiyaIchimiya
提出日時 2020-05-07 08:50:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 334 bytes
コンパイル時間 1,487 ms
コンパイル使用メモリ 165,536 KB
実行使用メモリ 7,944 KB
最終ジャッジ日時 2023-09-16 07:44:42
合計ジャッジ時間 5,218 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,856 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	int N, K;
	string S;
	cin >> N >> K >> S;

	for (int i = 0; i + K - 1 < N; i++) {
		int k = i + K - 1;
		string wk = S.substr(i, K);
		reverse(wk.begin(), wk.end());

		int x = 0;
		for (int j = i; j <= k; j++) {
			S.at(j) = wk.at(x);
			x++;
		}
	}

	cout << S << endl;
}
0