結果

問題 No.1020 Reverse
ユーザー Homuhomu
提出日時 2020-04-19 23:33:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 369 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 63,980 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-10-06 08:10:38
合計ジャッジ時間 5,696 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 2
other AC * 3 RE * 4 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;
int main() 
{
	int N,K;
	cin >> N;
	cin >> K;
	string S;
	cin >> S;
	for (int i = 1; i <= N - K + 1; ++i)
	{
		int b = i;
		int e = i + K - 1;
		int m = b - 1;
		int n = e - 1;
		while (m != n || m < n)
		{
			char c = S[m];
			S[m] = S[n];
			S[n] = c;
			++m;
			--n;
		}
	}
	cout << S << endl;
	return 0;
}
0