比较靠谱的代码
2026-04-17 19:33:16
发布于:广东
5阅读
0回复
0点赞
本解题针对新手,可能过程存在累赘,但算是很有稳定性和简单性了。
代码如下
#include <iostream>
using namespace std;
int main (){
int x;
cin >> x;
if (x >=300){
cout << "100";
}else if (x>=200&&x<300){
cout << "50";
}else if (x>=100&&x<200){
cout <<"20";
}else if (x<100){
cout <<"0";
}
return 0;
}
说白了,就看你if ,else 会不会用了
这里空空如也

有帮助,赞一个