結果
問題 | No.1020 Reverse |
ユーザー | betrue12 |
提出日時 | 2020-04-10 21:23:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 299 bytes |
コンパイル時間 | 2,244 ms |
コンパイル使用メモリ | 193,808 KB |
最終ジャッジ日時 | 2025-01-09 15:51:57 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N, K; cin >> N >> K; string S; cin >> S; string ans1 = S.substr(K-1, N-K+1); string ans2 = S.substr(0, K-1); if((N-K+1)%2) reverse(ans2.begin(), ans2.end()); cout << ans1 << ans2 << endl; return 0; }