考试

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
freopen("add.in","r",stdin);
freopen("add.out","w",stdout);
int a,b;
cin>>a>>b;
if(a+b<10) cout<<"water"<<endl;
if(a+b>=10&&a>b) cout<<"tree"<<endl;
if(a+b>=10&&a<b) cout<<"tea"<<endl;

return 0;
}

(分配)

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
freopen("add.in","r",stdin);
freopen("add.out","w",stdout);
int D,a,b,c;
cin>>D>>a>>b;
if(a>b){
c=D/(a-b); cout<<c<<endl;}
if(a<=b) cout<<"bye bye"<<endl;
return 0;
}

(蜗牛)

 

 

#include<iostream>
using namespace std;
int main()
{
freopen("add.in","r",stdin);
freopen("add.out","w",stdout);
int x,y,z,a,b,temp;
cin>>x>>y>>z>>a>>b;
if(x<y)
{
temp=x; x=y; y=temp;
}
if(x<z)
{
temp=x; x=z; z=temp;
}
if(x<a)
{
temp=x; x=a; a=temp;
}
if(x<b)
{
temp=x; x=b; b=temp;
}
if(y<z)
{
temp=y; y=z; z=temp;
}
if(y<a)
{
temp=y; y=a; a=temp;
}
if(y<b)
{
temp=y; y=b; b=temp;
}
if(z<a)
{
temp=z; z=a; a=temp;
}
if(z<b)
{
temp=z; z=b; b=temp;
}
if(a<b)
{
temp=a; a=b;b=temp;
}
cout<<b<<' '<<a<<' '<<z<<' '<<y<<' '<<x<<endl;
return 0;
}

(排序)

 

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
freopen("add.in","r",stdin);
freopen("add.out","w",stdout);
double a,b,x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
a=sqrt(1.0*(x1-x2)*(x1-x2)+1.0*(y1-y2)*(y1-y2));
b=sqrt(1.0*(x1-x2)*(x1-x2))+sqrt(1.0*(y1-y2)*(y1-y2));
cout<<setiosflags(ios::fixed)<<setprecision(2);
cout<<a<<endl;
cout<<b<<endl;
return 0;
}

(距离)

posted @ 2017-07-29 10:10  方尊  阅读(133)  评论(0)    收藏  举报