結果
| 問題 | No.3274 Arithmetic Right Shift | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-09-19 21:22:59 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 115 ms / 1,500 ms | 
| コード長 | 606 bytes | 
| コンパイル時間 | 1,931 ms | 
| コンパイル使用メモリ | 196,024 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-09-19 21:23:02 | 
| 合計ジャッジ時間 | 2,533 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
    int tc;
    cin >> tc;
    while(tc--)
    {
        int n;
        string s;
        cin >> n;
        cin >> s;
        while(n > 0)
        {
            int cnt0 = 0;
            int cnt1 = 0;
            for(auto ch : s)
            {
                if(ch=='0') cnt0+=1;
                else cnt1+=1;
            }
            if(cnt0==0 || cnt1==0) break;
            s.pop_back();
            s = s[0] + s;
            n-=1;
        }
        cout << s << '\n';
    }
	return 0;
}
            
            
            
        