标签:技术分享 man 注释 1.4 top 考试 width sqrt amp
#include<iostream> #include<cstdio> using namespace std; int main() { freopen("task.in","r",stdin) freopen("task.out","w",stout) int m,n; cin>>m>>n; if(m+n<10) cout<<"water"<<endl; if(m+n>=10&&m>n) cout<<"tree"<<endl; if(m+n>=10&&m<=n) cout<<"tea"<<endl; return 0; }
#include<iostream> #include<iomanip> #include<cmath> #include<cstdio> using namespace std; int main() { freopen("distance.in","r",stdin) freopen("distance.out","w",stout) int x1,y1,x2,y2; double a,b,c,d; cin>>x1>>y1>>x2>>y2; a=sqrt(1.0*(x1-x2)*(x1-x2)+1.0*(y1-y2)*(y1-y2)); if)(x1<x2) b=x2-x1; else b=x1-x2; if(y1<y2) c=y2-y1; else c=y1-y2; d=b+c; cout<<setiosflags(ios::fixed)<<setprecision(2); cout<<a<<endl; cout<<d<<endl; return 0; }
#include<iostream> #include<cstdio> using namespace std; int main() { freopen("snail.in","r",stdin) freopen("snail.out","w",stout) int D,a,b,x=0; cin>>D>>a>>b; if(a<=d&&D>a) cout<<"bye bye"<<endl; else { for(;;) { x++ D-=a; if(D<0) break; D+=b; } cout<<x<<endl; } return 0; }
#include<iostream> #include<cstdio> usinf namespace std; int main() { freopen("fivesort.in","r",stdin) freopen("fivesort.out","w",stout) int a,b,c,d,e; cin>>a>>b>>c>>d>>e; for(int i=1;i<=1000;i++) { if(i==a) cout<<a<<‘ ‘; if(i==b) cout<<b<<‘ ‘; if(i==c) cout<<c<<‘ ‘; if(i==d) cout<<d<<‘ ‘; if(i==e) cout<<e<<‘ ‘; } return 0; }
#include<iostream> #include<cstdio> usinf namespace std; int main() { freopen("fivesort.in","r",stdin) freopen("fivesort.out","w",stout) int a,b,c,d,e; cin>>a>>b>>c>>d>>e; for(int i=1;i<=1000;i++) { if(i==a) cout<<a<<‘ ‘; if(i==b) cout<<b<<‘ ‘; if(i==c) cout<<c<<‘ ‘; if(i==d) cout<<d<<‘ ‘; if(i==e) cout<<e<<‘ ‘; } return 0; }
1.分配任务
(task.pas/c/cpp)
【问题描述】
在社会实践活动中有三项任务分别是:种树、采茶、送水。依据小组人数及男生、女生人数决定小组的接受任务,人数小于10人的小组负责送水(输出water),人数大于等于10人且男生多于女生的小组负责种树(输出tree),人数大于等于10人且男生不多于女生的小组负责采茶(输出tea)。输入小组男生人数、女生人数,输出小组接受的任务。
【输入】
一行两个空格隔开的数,表示小组中男生和女生的人数。
【输出】
输出对应的任务。
【输入输出样例1】
task.in |
task.out |
5 3 |
water |
【数据范围】
数据保证输入的两个整数小于等于15。
【注释】
本次考试不及格的同学可能会被分入其中一组哦。
2.计算距离
(distance.pas/c/cpp)
【问题描述】
在平面中之角坐标系中,两个点A(x1,y1),B(x2,y2)的距离有很多种衡量方式,其中有两种很常用。
第一种是直线距离:
第二种叫做曼哈顿距离,公式如下:
【输入】
四个正整数x1,y1,x2,y2。
【输出】
一共两行,每行一个数。
第一行输出直线距离。
第二行输出曼哈顿距离。
要求:保留两位小数。
【输入输出样例1】
distance.in |
distance.out |
1 1 2 2 |
1.41 2.00 |
【数据范围】
x1,y1,x2,y2都是100000以内的正整数
3.蜗牛
(snail.pas/c/cpp)
【问题描述】
蒟蒻蜗牛lzh掉到了一口深井底部,但是他有梦想,他一定要爬出来!!
已知井的深度D厘米,以及lzh每天白天能向上爬a厘米。但是最惨的在后面:lzh每天晚上睡觉的时候都会向下滑b厘米。现在是第一天早上,lzh开始向上爬,lzh想知道从今天算起,他第几天才能重见天日(爬出深井)。
【输入】
一行三个空格隔开的正整数D,a,b。
【输出】
如果lzh能爬上来,输出一个数,代表lzh第几天才能重见天日,如果lzh永远爬不上来,输出“bye bye”。
【输入输出样例1】
snail.in |
snail.out |
10000 6 1 |
2000 |
【输入输出样例2】
snail.in |
snail.out |
7 6 6 |
bye bye |
【数据范围】
1<=D<=100000
【注释】
能碰到井口就算爬出深井,例如,对于10厘米的井,如果lzh能上升10厘米或10厘米以上,就算爬出深井。蜗牛的身体长度不计。
4.鱼的排队
(fivesort.pas/c/cpp)
【问题描述】
lxt有一项超能力,就是和焦作一中的湖里的鱼儿进行交流。
lxt和其中的5条鱼成为了最好的朋友,他决定在某一天让这5条鱼排成一队,在湖里游行,排队的规则就是按照鱼的编号从小到大进行。
现在lxt知道了这5条鱼的编号,想知道这5条鱼的编号从小到大排序后的结果,希望你写个程序帮助他。
对于写过3个数排序的你来说,5条鱼的排序当然不在话下。
【输入】
一行,5个用空格隔开的整数。
【输出】
一行,从小到大排序后的整数,每个整数用1个空格隔开。
【输入输出样例1】
fivesort.in |
fivesort.out |
5 4 2 3 1 |
1 2 3 4 5 |
【输入输出样例2】
fivesort.in |
fivesort.out |
11 33 33 22 11 |
11 11 22 33 33 |
【数据范围】
保证5个整数都是1000以内的正数。
【注释】
本题就是传说中的附加题。
今天是检验前三天成果的一天,因为今天第一次考试了。而我考的非常不好,所以我总结分析了原因:
1.循环运用极其不熟练;(循环没有掌握,要记得回归课本)
2.做题时不知道什么时候用if语句,什么时候用循环;
3.不会建立循环。
标签:技术分享 man 注释 1.4 top 考试 width sqrt amp
原文地址:http://www.cnblogs.com/wj1355926503/p/7256203.html