結果
問題 |
No.1020 Reverse
|
ユーザー |
|
提出日時 | 2020-04-10 21:40:05 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 502 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 128,704 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 17:27:09 |
合計ジャッジ時間 | 1,475 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 6 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; int main() { int n,k; string s; cin >> n >> k >> s; string ans; if (n!=k) { for (int i=k-1; i<n; i++) ans += s[i]; for (int i=0; i<k-1; i++) ans += s[i]; } else { ans = s; reverse(ans.begin(), ans.end()); } cout << ans << endl; // for (int i=0; i+k-1<n; i++) { // reverse(s.begin()+i, s.begin()+i+k); // } // cout << s << endl; }