結果

問題 No.3274 Arithmetic Right Shift
ユーザー Jikky1618
提出日時 2025-09-20 00:58:04
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 1,500 ms
コード長 622 bytes
コンパイル時間 3,818 ms
コンパイル使用メモリ 277,200 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-20 00:58:09
合計ジャッジ時間 3,735 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...)
#endif

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int T;
    cin >> T;
    while (T--) {
        int K;
        string S;
        cin >> K >> S;
        int N = ssize(S);
        if (K > N) {
            cout << string(N, S.front()) << "\n";
        } else {
            while (K--) {
                S.insert(S.begin(), S.front());
                S.pop_back();
            }
            cout << S << "\n";
        }
    }
}
0