結果

問題 No.1020 Reverse
ユーザー hanbei_dayohanbei_dayo
提出日時 2020-04-10 22:17:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 83,228 KB
実行使用メモリ 6,108 KB
最終ジャッジ日時 2023-10-14 00:56:52
合計ジャッジ時間 1,632 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;

vector<ll>r[100010];
ll rd[100010];
int main(void){
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    if(k==s.length()){
        for(int i=0;i<n;i++)cout<<s[n-1-i];
        cout<<endl;
    }
    else{
        for(int i=k-1;i<n;i++)cout<<s[i];
        for(int i=0;i<k-1;i++)cout<<s[i];
        cout<<endl;
    }
    return 0;
}
0