要么使用printf和scanf要么使用cout,cin中添加以下几行代码 ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);