結果

問題 No.1020 Reverse
ユーザー catupper
提出日時 2020-04-10 21:53:56
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 646 bytes
コンパイル時間 720 ms
コンパイル使用メモリ 82,508 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 20:14:43
合計ジャッジ時間 1,552 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;



int main(){
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;
    for(int i = k-1;i < n;i++)cout << s[i];
    if((n-k)%2 ==0)
        for(int i = k-2;i >= 0;i--)cout << s[i];
    else
        for(int i = 0;i < k-1;i++)cout << s[i];
    cout << endl;
    return 0;
}
0