首师大附中科创教育平台我的刷题记录(好久没有给大家这样刷5道题了,今天破例,给大家刷41--45题吧)
仅供同学们参考,禁止抄袭!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#include<iostream> using namespace std; int main() { int a,b; cin>>a>>b; if(a!=2&&a!=0&&a!=5) cout<<"输入有误"; else if(b!=2&&b!=0&&b!=5) cout<<"输入有误"; else if(a==5&&b==0) cout<<"甲WIN!"; else if(a==2&&b==0) cout<<"乙WIN!"; else if(a==5&&b==2) cout<<"乙WIN!"; else if(a==2&&b==5) cout<<"甲WIN!"; else if(a==0&&b==5) cout<<"乙WIN!"; else if(a==0&&b==2) cout<<"甲WIN!"; else if(a==b) cout<<"平局"; return 0; //system("pause"); }
#include<iostream> #include<cmath> using namespace std; int main() { int a,b,c,s; cin>>a>>b>>c; if(a+b>c && a+c>b && b+c>a) { s=sqrt((a+b+c)*(b+c-a)*(a-b+c)*(a+b-c))/4; cout<<s<<endl; } else cout<<a<<","<<b<<","<<c<<"的值不能构成三角形"<<endl; //system("pause"); return 0; }
#include<iostream> using namespace std; int main() { double n; cin>>n; if(n>=0)cout<<n; if(n<0)cout<<n-n-n; return 0; }
#include<iostream> using namespace std; int main() { double n; cin>>n; if(n<100)cout<<1; if(n>=100&&n<5000)cout<<n*1/100; if(n>=5000&&n<10000)cout<<n*3/200; if(n>=10000)cout<<150; return 0; }
#include<iostream> using namespace std; int main() { double x,y; cin>>x; if(x<0.3) y=0; if(x>=0.3&&x<=0.8) y=(x-0.3)/0.5; if(x>0.8) y=1; cout<<y; //system("pause"); }