建议降红,to_string就能过
查看原帖
建议降红,to_string就能过
1074084
asd890123楼主2024/4/6 20:30
#include <bits/stdc++.h>

using namespace std;

int main(){
    
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    
    int n,t;
    string s;
    
    cin >> n;
    t = n;
    s = to_string(n);
    do{
        
        t /= 2;
        s += to_string(t);
        
    } while (t != 0);
    cout << s.length() - 1 << endl;
    
    return 0;
}
2024/4/6 20:30
加载中...