12 条题解

  • 4
    @ 2021-12-5 19:11:08

    直接上代码,有空更新题解

    #include <iostream>
    #include <stdio.h>
    using namespace std;
    
    int main()
    {
        double x,y;
    
        cin>>x;
        if(0<=x&&x<5){
            y=-x+2.5;
        }
        else if(5<=x&&x<10){
            y=2-1.5*(x-3)*(x-3);
        }
        else {
        y=x/2-1.5;
        }
        printf("%.3f",y) ;
        return 0;
    }
    
    • 3
      @ 2024-11-22 20:23:51

      #include<iostream> #include<iomanip> #include<cmath> using namespace std; int main() {

      double x,y; cin>>x; if(0<=x&&x<5) { y=x*-1+2.5; } else if(5<=x&&x<10) { y=2-1.5*(x-3)*(x-3); } else if(10<=x&&x<20) { y=x/2-1.5; } cout<<fixed<<setprecision(3)<<y; return 0;

      }

      • 0
        @ 2024-12-7 18:26:49
        //冒泡排序
        #include<bits/stdc++.h>
        using namespace std;
        const int N=1e5+10;
        int main(){
        	double x,sum;cin>>x;if(x>=0&&x<=5) sum=-x+2.5;
        	else if(x>=5&&x<=10){
        		sum=2-1.5*(x-3)*(x-3);
        	}
        	else if(x>=10&&x<=20)
        		sum=x*0.5-1.5;
        	cout<<fixed<<setprecision(3)<<sum<<endl;
        	return 0;
        }
        
        • 0
          @ 2024-11-24 11:30:54
          #include<iomanip>
          using namespace std;
          int main()
          {
          	double w,h;
          	cin>>w;
          	if(0<=w&&w<5)
          	{
          	h=-w+2.5;
          	}
          	else if(5<=w&&w<10)
          	{
          	h=2-1.5*(w-3)*(w-3);
          	}
          	else if(10<=w&&w<20)
          	{
          	h=w/2-1.5;
          	}
          	cout<<fixed<<setprecision(3)<<h;
          }
          
          • 0
            @ 2024-4-19 20:07:03
            #include <iostream>
            #include <stdio.h>
            using namespace std;
            
            int main()
            {
                double x,y;
            
                cin>>x;
                if(0<=x&&x<5){
                    y=-x+2.5;
                }
                else if(5<=x&&x<10){
                    y=2-1.5*(x-3)*(x-3);
                }
                else {
                y=x/2-1.5;
                }
                printf("%.3f",y) ;
                return 0;
            }
            
            • 0
              #include <bits/stdc++.h>
              using namespace std;
              const int N=1e7+10;
              const int INF=0x3f3f3f3f;
              int main()
              {
              	double x,y;
              	cin>>x;
              	if(0<=x&&x<5)
              	{
              		y=-x+2.5;
              	}
              	else if(5<=x&&x<10)
              	{
              		y=2-1.5*(x-3)*(x-3);
              	}
              	else if(10<=x&&x<20)
              	{
              		y=x/2-1.5;
              	}
              	cout<<fixed<<setprecision(3)<<y;
              	return 0;
              }
              
              • 0
                @ 2022-9-27 17:37:34

                #include <iostream> #include <iomanip> using namespace std; int main(){ double n; cin>>n; if(0<=n&&n<5) n=-n+2.5; else if(5<=n&&n<10) n=2-1.5*(n-3)*(n-3); else n=n/2-1.5; cout<<fixed<<setprecision(3)<<n<<endl; return 0; }

                • -1
                  @ 2022-9-27 17:36:50

                  #include <iostream> #include <iomanip> using namespace std; int main(){ double n; cin>>n; if(0<=n&&n<5) n=-n+2.5; else if(5<=n&&n<10) n=2-1.5*(n-3)*(n-3); else n=n/2-1.5; cout<<fixed<<setprecision(3)<<n<<endl; return 0; }

                  • -1
                    @ 2022-9-27 17:36:37

                    #include <iostream> #include <iomanip> using namespace std; int main(){ double n; cin>>n; if(0<=n&&n<5) n=-n+2.5; else if(5<=n&&n<10) n=2-1.5*(n-3)*(n-3); else n=n/2-1.5; cout<<fixed<<setprecision(3)<<n<<endl; return 0; }

                    • -1
                      @ 2022-8-12 21:32:37
                      #include<bits/stdc++.h>
                      #include <iostream>
                      #include <iomanip>
                      using namespace std;
                      int main(){
                          double n;
                          cin>>n;
                          if(0<=n&&n<5)
                              n=-n+2.5;
                          else if(5<=n&&n<10)
                              n=2-1.5*(n-3)*(n-3);
                          else
                              n=n/2-1.5;
                          printf("%.3lf",n);
                          return 0;
                      }
                      
                      • -2
                        @ 2022-1-23 13:49:03
                        #include <iostream>
                        #include <iomanip>
                        using namespace std;
                        int main(){
                            double n;
                            cin>>n;
                            if(0<=n&&n<5)
                                n=-n+2.5;
                            else if(5<=n&&n<10)
                                n=2-1.5*(n-3)*(n-3);
                            else
                                n=n/2-1.5;
                            cout<<fixed<<setprecision(3)<<n<<endl;
                            return 0;
                        }
                        • -5
                          @ 2022-2-9 11:16:45

                          ggf nj

                          • 1

                          信息

                          ID
                          856
                          时间
                          1000ms
                          内存
                          128MiB
                          难度
                          4
                          标签
                          递交数
                          445
                          已通过
                          216
                          上传者