【題解】Codeforces 1400A. String Similarity

【題目敘述】http://codeforces.com/contest/1400/problem/A

#include <iostream>
using namespace std;
 
int t, n;
string s;
 
int main() {
    cin >> t;
    while (t--){
        cin >> n >> s;
        if (s[n-1] == '1'){
            for (int i = 0; i < n; i++){
                cout << '1';
            }
        }
        else{
            for (int i = 0; i < n; i++){
                cout << '0';
            }
        }
        cout << "\n";
    }
}
分享本文 Share with friends