2 条题解

  • 1
    @ 2025-3-23 12:13:48
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	double x,y;
    	cin>>x;
    	if(x>=0&&x<5) y=-x+2.5;
    	else if(x>=5&&x<10) y=2-1.5*(x-3)*(x-3);
    	else if(x>=10&&x<20) y=x/2.0-1.5;
    	cout<<fixed<<setprecision(3)<<y;
    	return 0;
    }
    
    
    • 1
      @ 2025-1-27 10:06:30
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
      	double x,y;
      	cin>>x;
      	if(x>=0&&x<5) y=-x+2.5;
      	else if(x>=5&&x<10) y=2-1.5*(x-3)*(x-3);
      	else if(x>=10&&x<20) y=x/2.0-1.5;
      	cout<<fixed<<setprecision(3)<<y;
      	return 0;
      }
      
      • 1

      信息

      ID
      42
      时间
      1000ms
      内存
      128MiB
      难度
      3
      标签
      (无)
      递交数
      96
      已通过
      51
      上传者