File size: 410 Bytes
c4b0eef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
    進位轉換
*/
#include <iostream>
#include <string>

using namespace std;

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);

    string number;
    int n_testcase;
    cin >> n_testcase;
    while (n_testcase--) {
        cin >> number;
        cout << __builtin_popcount(stoi(number, NULL, 10)) << " " << __builtin_popcount(stoi(number, NULL, 16)) << "\n";
    }

    return 0;
}