結果
| 問題 | No.3274 Arithmetic Right Shift | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-09-19 21:44:00 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 6 ms / 1,500 ms | 
| コード長 | 521 bytes | 
| コンパイル時間 | 3,069 ms | 
| コンパイル使用メモリ | 280,300 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-09-19 21:44:42 | 
| 合計ジャッジ時間 | 3,714 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n" 
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;cin>>t;
    while(t--){
        int k;cin>>k;
        string s;cin>>s;
        int n = s.size();
        string ans;
        if(k>=n){
            string t(n,s[0]);
            ans = t;
        }else{
            ans = s.substr(0,n-k);
            string t(k,s[0]);
            ans = t+ans;
        }
        cout<<ans<<endl;
    }
    return 0;
}
            
            
            
        