結果

問題 No.1020 Reverse
ユーザー musuchika3musuchika3
提出日時 2020-04-11 12:48:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 740 bytes
コンパイル時間 2,969 ms
コンパイル使用メモリ 167,172 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 02:09:37
合計ジャッジ時間 2,959 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 6 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 7 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 9 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 9 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 9 ms
4,348 KB
testcase_16 WA -
testcase_17 AC 8 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,b,n) for(ll i=b;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

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


0