結果
| 問題 |
No.1020 Reverse
|
| コンテスト | |
| ユーザー |
root__786
|
| 提出日時 | 2020-04-14 16:38:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 305 bytes |
| コンパイル時間 | 2,691 ms |
| コンパイル使用メモリ | 193,148 KB |
| 最終ジャッジ日時 | 2025-01-09 18:44:16 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
long long n,k;
cin>>n>>k;
string s;
cin>>s;
string l=s.substr(k-1,n-k+1);
string r=s.substr(0,k-1);
if((n-k)%2==0){
reverse(r.begin(),r.end());
}
cout<<(l+r)<<endl;
return 0;
}
root__786