結果

問題 No.1020 Reverse
ユーザー polyesterpolyester
提出日時 2020-04-10 21:36:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 570 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 82,948 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-13 23:38:53
合計ジャッジ時間 4,352 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<cmath>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstdio>
#include<numeric>
using namespace std;
using ll = long long;
int main(){
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  for(int i = 0; i < n - k + 1; i++){
    string tmp;
    for(int j = i; j < i + k; j++){
      tmp += s[j];
    }
    reverse(tmp.begin(), tmp.end());
    for(int j = i; j < i + k; j++){
      s[j] = tmp[j - i];
    }
  }
  cout << s << endl;
  return 0;
}
0