WOJ1004-Noah's Ark

Now,our story begins.As usual,I'll tell you the background as follows:
6:13 And God said to Noah, The end of all flesh has come; the earth is full of their violent doings, and now I will put an end to them with the earth.
6:14 Make for yourself an ark of gopher wood with rooms in it, and make it safe from the water inside and out.
6:15 And this is the way you are to make it: it is to be three hundred cubits long, fifty cubits wide, and thirty cubits high.
6:16 You are to put a window in the ark, a cubit from the roof, and a door in the side of it, and you are to make it with a lower and second and third floors.
6:17 For truly, I will send a great flow of waters over the earth, for the destruction from under the heaven of all flesh in which is the breath of life; everything on the earth will come to an end.
6:18 But with you I will make an agreement; and you will come into the ark, you and your sons and your wife and your sons' wives with you.
6:19 And you will take with you into the ark two of every sort of living thing, and keep them safe with you; they will be male and female.
6:20 Two of every sort of bird and cattle and of every sort of living thing which goes on the earth will you take with you to keep them from destruction.
6:21 And make a store of every sort of food for yourself and them.
6:22 And all these things Noah did; as God said, so he did.

Most Hebrew scholars believe the cubit to have been 18 inches long [45.72 centimeters]. This means that the ark would have been 450 feet long [137.16 meters], 75 feet wide [22.86 meters] and 45 feet high [13.716 meters]. Noah's Ark was said to have been the largest sea going vessel ever built until the late nineteenth century when giant metal ships were first constructed. Its length to width ratio ofexactlysix to one provided excellent stability on the high seas. In fact, modern shipbuilders say it would have been almost impossible to turn over. In every way, it was admirably suited for riding out the tremendous storms in the year of the flood.


These dimensions are especially interesting when compared to those given in the mythical, Babylonian account of the Ark. Here the ark is described as a perfect cube, extending 120 cubits in all directions and with nine decks. Such a vesselwith the same length and width would spin slowly round and round in the water and from the standpoint of stability, would be a disaster.


You task is to show me stability of Noah's Ark.

输入格式

There will be multiple test cases.For each test case,there'll be three lines listing the length,width and height of the
Ark in the myth.Each line has the following form:
L meters/centimeters/inches/cubits/feet where L is a double number. Each test case will be separated by a blank line.

输出格式

For each test case,if the Ark's length to width ratio provides excellent stability,output "Excellent", else if
the Ark's length of width ratio makes it spin slowly round and round, output "Spin",else output "Neither".
Then, you must output a blank line after each test case.

样例输入

120 cubits
120 cubits
110 cubits

450 feet
22.86 meters
30 cubits

样例输出

Spin

Excellent

提示

In order to compare converted unions, you should specify a small value, for example, 1e-9.

If the difference of two double value is less than the threshhold, then you can say they are the same.


#include <stdio.h>  
#include <math.h>  
#include <string.h>  
#define yz 1e-9
double hs(double a,char *c)
{        
    double k=1.0;  
    if(strcmp(c,"meters")==0)k=100.0;  
    if(strcmp(c,"cubits")==0)k=45.72;  
    if(strcmp(c,"feet")==0)k=30.48;  
    if(strcmp(c,"inches")==0)k=2.54;  
    a=a*k;  
    return a;        
}
int main()  
{           
    double length,width,height;  
    double b[2]={0.0,0.0};  
    char dlength[20],dwidth[20],dheight[20];  
    while(scanf("%lf",&length)!=EOF)  
    {  
        scanf("%s",dlength);  
        scanf("%lf",&width);  
        scanf("%s",dwidth);  
        scanf("%lf",&height);
        scanf("%s",dheight);  
        b[0]=hs(length,dlength);  
        b[1]=hs(width,dwidth);  
        if(fabs((b[0]-b[1]))<yz) printf("Spin\n");  
        else{  
            if(fabs((b[0]-6*b[1]))<yz) printf("Excellent\n");  
            else printf("Neither\n");
		}  
        printf("\n");
    }
    return 0;
}  


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值