結果
問題 | No.1020 Reverse |
ユーザー |
![]() |
提出日時 | 2020-07-19 20:06:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 240 bytes |
コンパイル時間 | 1,964 ms |
コンパイル使用メモリ | 194,336 KB |
最終ジャッジ日時 | 2025-01-12 00:57:02 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int N, K;string S;cin >> N >> K >> S;cout << S.substr(K - 1);string T = S.substr(0, K - 1);if ((N - K + 1) % 2) reverse(T.begin(), T.end());cout << T << "\n";}