結果

問題 No.1020 Reverse
ユーザー chocorusk
提出日時 2020-02-26 20:16:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 67,996 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-13 15:45:08
合計ジャッジ時間 1,622 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
    int n, k;
	cin>>n>>k;
	string s;
	cin>>s;
	string a=s.substr(k-1), b=s.substr(0, k-1);
	if((n-k)%2==0) reverse(b.begin(), b.end());
	cout<<a+b<<endl;
    return 0;
}
0