結果
| 問題 |
No.1020 Reverse
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-31 04:59:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 535 bytes |
| コンパイル時間 | 1,026 ms |
| コンパイル使用メモリ | 94,524 KB |
| 最終ジャッジ日時 | 2025-01-10 19:57:32 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <numeric>
#include <math.h>
#include <map>
using namespace std;
typedef long long int ll;
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n,k; cin >> n >> k;
string s; cin >> s;
string t=s;
for(int i=0;i<n-k+1;i++){
t[i]=s[k-1+i];
}
for(int i=n-k+1;i<n;i++){
if((n-k)%2){
t[i]=s[i-(n-k+1)];
}else{
t[i]=s[(k-2)-(i-(n-k+1))];
}
}
cout << t << endl;
}