結果
問題 | No.1020 Reverse |
ユーザー |
![]() |
提出日時 | 2020-04-10 21:24:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 367 bytes |
コンパイル時間 | 2,140 ms |
コンパイル使用メモリ | 192,584 KB |
最終ジャッジ日時 | 2025-01-09 15:52:42 |
ジャッジサーバーID (参考情報) |
judge5 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x)+modulo)%modulo) #define Inf 100000000 int main() { int N,K; cin>>N>>K; string S; cin>>S; string ans = S.substr(K-1); string T = S.substr(0,K-1); if((N-K+1)%2==1)reverse(T.begin(),T.end()); ans+=T; cout<<ans<<endl; return 0; }