結果
問題 |
No.1020 Reverse
|
ユーザー |
![]() |
提出日時 | 2023-08-24 19:21:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 379 bytes |
コンパイル時間 | 1,010 ms |
コンパイル使用メモリ | 102,156 KB |
最終ジャッジ日時 | 2025-02-16 13:11:59 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#include<iostream> #include<map> #include<vector> #include <algorithm> #include<math.h> #include <iomanip> #include<set> #include <numeric> using namespace std; int main() { int n, k; string s, pre, post; cin >> n >> k >> s; pre = s.substr(0, k-1); post = s.substr(k-1); if ((n-k+1)%2) reverse(pre.begin(), pre.end()); cout << post + pre << endl; }