12 条题解
-
0
- 1
信息
- ID
- 856
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 454
- 已通过
- 218
- 上传者
#include<iomanip>
#include<cmath>
using namespace std;
double x,y;
int main()
{
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;
}
//冒泡排序
#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;
}
#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;
}
#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;
}