結果
問題 | No.1020 Reverse |
ユーザー |
![]() |
提出日時 | 2020-04-12 01:05:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 372 bytes |
コンパイル時間 | 1,392 ms |
コンパイル使用メモリ | 168,664 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 19:15:47 |
合計ジャッジ時間 | 2,617 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; using namespace std; int main() { int N, K; cin >> N >> K; string S; cin >> S; string s1 = S.substr(0, K - 1); string s2 = S.substr(K - 1); if ((N - K) % 2 == 0) reverse(all(s1)); cout << s2 + s1 << endl; }