1 条题解

  • 0
    @ 2026-10-2 2:21:27

    C++ :

    #include <iostream>
    #include <iomanip>
    using namespace std;
    int main()
    {
    	double x,y,t;
     	cin>>x;
     	t=int(x)/5.0;
     	switch(int (t))
     	{
    		case 0:y=(-x)+2.5;break;
         	 	case 1:y=2-1.5*(x-3)*(x-3);break;
         	 	case 2:
         	 	case 3:y=x/2-1.5; break;
     	}
     	cout<<setiosflags(ios::fixed)<<setprecision(3)<<y<<endl;
     	return 0;
    }
    
    • 1

    信息

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