結果
| 問題 |
No.1020 Reverse
|
| コンテスト | |
| ユーザー |
Forested
|
| 提出日時 | 2020-05-26 12:21:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 532 bytes |
| コンパイル時間 | 709 ms |
| コンパイル使用メモリ | 92,152 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 02:37:47 |
| 合計ジャッジ時間 | 1,414 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
int main(void) {
int N, K;
string S;
cin >> N >> K >> S;
string s = S.substr(0, K - 1);
string t = S.substr(K - 1, N - K + 1);
if ((N - K + 1) % 2) reverse(s.begin(), s.end());
cout << t << s << endl;
return 0;
}
Forested