本地全过,洛谷全错。
查看原帖
本地全过,洛谷全错。
933934
XVETV6楼主2023/4/8 00:46

洛谷不能在 cout 里出现\b吗?
代码:


#include <iostream>
using namespace std;
void f(int x,int y) {
    if (x == 0) {
        return;
    }
    f(x >> 1, y + 1);
    if (x & 1) {
        if(y==0)
            cout << "2(0)+";
        else if(y==1)
            cout << "2+";
        else {
            cout << "2(";
            f(y, 0);
            cout << "\b)+";//这里
        }
    }
    return;
}
int main() {
    int n;
    cin >> n;
    f(n,0);
    cout << "\b ";//这里
    return 0;
}

在线IDE里面对应位置都是乱码。。。

2023/4/8 00:46
加载中...