day 2

代码凑数(考试)// 主要不知道代码放哪.....................

TASK 1

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
freopen("task.in","r",stdin);
freopen("task.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+a>=10)&&(a<=b)) cout<<"tea"<<endl;
return 0;
}

OVER

 FIVESORT 2

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

freopen("fivesort.in","r",stdin);
freopen("fivesort.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(y<z)
{
temp=y;y=z; z=temp;
}
if(a<b)
{
temp=a; a=b; b=temp;
}
if(x<a)
{
temp=x; x=a; a=temp;
}
if(y<a)
{
temp=y; y=a; a=temp;
}
if(z<a)
{
temp=z; z=a; a=temp;
}
if(x<b)
{
temp=x; x=b; b=temp;
}
if(y<b)
{
temp=y; y=b; b=temp;
}
if(z<b)
{
temp=z; z=b; b=temp;
}
cout<<b<<' '<<a<<' '<<z<<' '<<y<<' '<<x<<endl;

return 0;
}

OVER

//

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
freopen("fivesort.in","r",stdin);
freopen("fivesort.out","w",stdout);
int a,b,c,d,e,minn;
cin>>a>>b>>c>>d>>e;
for(int i=1;i<=5;i++)
{
minn=1000000;
if(a<minn)
minn=a;
if(b<minn)
minn=b;
if(c<minn)
minn=c;
if(d<minn)
minn=d;
if(e<minn)
minn=e;
if(a==minn)
a=10000000;
else
{
if(b==minn)
b=1000000;
else
{
if(c==minn)
c=10000000;
else
{
if(d==minn)
d=10000000;
else
e=10000000;
}
}
}
cout<<minn<<' ';
}
return 0;
}

OVER

SNAIL 3

#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
freopen("snail.in","r",stdin);
freopen("snail.out","w",stdout);
int depth,days,u,d;
cin>>depth>>u>>d;
if(u<=d&&u<depth)
cout<<"bye bye";
else
{
for(int i=1;i<=10000000;i++)
{
days=i;
depth-=u;
if(depth<=0)
break;
depth+=d;
if(depth<=0)
break;
}
cout<<days;
}

OVER

//

freopen("snail.in","r",stdin);
freopen("snail.out","w",stdout);
int D,a,b,x;
cin>>D>>a>>b;
if((a>b)&&(D%a==0))
{
x=D/(a-b);
cout<<x<<endl;
}
if((a>b)&&(D%a!=0)) cout<<D/(a-b)+1<<endl;
if(a<=b) cout<<"bye bye" <<endl;
if(a>D)cout<<1<<endl;

return 0;
}

OVER

DISTANCE 4

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

freopen("distance.in","r",stdin);
freopen("distance.out","w",stdout);
double x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
double a,b;
a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
if((x1-x2>=0)&&(y1-y2>=0)) b=x1-x2+y1-y2;
if((x1-x2>=0)&&(y1-y2<0)) b=x1-x2-y1+y2;
if((x1-x2<0)&&(y1-y2>=0)) b=x2-x1+y1-y2;
if((x1-x2<0)&&(y1-y2<0)) b=x2+y2-x1-y1;
cout<<setiosflags(ios::fixed)<<setprecision(2);
cout<<a<<endl;
cout<<b<<endl;
return 0;
}

OVER

转载于:https://www.cnblogs.com/nzx106/p/7257346.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值