#include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x;
if(x<1)
y=x;
else if(x>=10)
y=4*x-2;
else
y=3*x-1;
cout<<y<<endl;
return 0;
}
1041 分段函数1
最新推荐文章于 2021-03-19 21:17:14 发布
#include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x;
if(x<1)
y=x;
else if(x>=10)
y=4*x-2;
else
y=3*x-1;
cout<<y<<endl;
return 0;
}