結果

問題 No.1020 Reverse
ユーザー square1001
提出日時 2020-04-10 21:33:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 607 ms
コンパイル使用メモリ 66,560 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 19:21:56
合計ジャッジ時間 1,379 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <iostream>
using namespace std;
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int N, K; string S;
	cin >> N >> K >> S;
	for (int i = 0; i < N; ++i) {
		cout << S[i <= N - K ? i + K - 1 : ((N - K) % 2 == 0 ? N - i - 1 : K - (N - i) - 1)];
	}
	cout << endl;
	return 0;
}
0