WOJ1003-Birth of Noah
来源:互联网 发布:手机恶作剧软件大全 编辑:程序博客网 时间:2024/04/30 14:07
The following is the family of Noah.
5:1 This is the book of the generations of Adam. In the day when God made man, he made him in the image of God;
5:2 Male and female he made them, naming them Man, and giving them his blessing on the day when they were made.
5:3 Adam had been living for a hundred and thirty years when he had a son like himself, after his image, and gave him the name of Seth:
5:4 And after the birth of Seth, Adam went on living for eight hundred years, and had sons and daughters:
5:5 And all the years of Adam's life were nine hundred and thirty: and he came to his end.
5:6 And Seth was a hundred and five years old when he became the father of Enosh:
5:7 And he went on living after the birth of Enosh for eight hundred and seven years, and had sons and daughters:
5:8 And all the years of Seth's life were nine hundred and twelve: and he came to his end.
5:9 And Enosh was ninety years old when he became the father of Kenan:
5:10 And after the birth of Kenan, Enosh went on living for eight hundred and fifteen years, and had sons and daughters:
5:11 And all the years of Enosh were nine hundred and five: and he came to his end.
5:12 And Kenan was seventy years old when he became the father of Mahalalel:
5:13 And after the birth of Mahalalel, Kenan went on living for eight hundred and forty years, and had sons and daughters:
5:14 And all the years of Kenan's life were nine hundred and ten; and he came to his end.
5:15 And Mahalalel was sixty-five years old when he became the father of Jared:
5:16 And after the birth of Jared, Mahalalel went on living for eight hundred and thirty years, and had sons and daughters:
5:17 And all the years of Mahalalel's life were eight hundred and ninety-five: and he came to his end.
5:18 And Jared was a hundred and sixty-two years old when he became the father of Enoch:
5:19 And Jared went on living after the birth of Enoch for eight hundred years, and had sons and daughters:
5:20 And all the years of Jared's life were nine hundred and sixty-two: and he came to his end.
5:21 And Enoch was sixty-five years old when he became the father of Methuselah:
5:22 And after the birth of Methuselah, Enoch went on in God's ways for three hundred years, and had sons and daughters:
5:23 And all the years of Enoch's life were three hundred and sixty-five:
5:24 And Enoch went on in God's ways: and he was not seen again, for God took him.
5:25 And Methuselah was a hundred and eighty-seven years old when he became the father of Lamech:
5:26 And after the birth of Lamech, Methuselah went on living for seven hundred and eighty-two years, and had sons and daughters:
5:27 And all the years of Methuselah's life were nine hundred and sixty-nine: and he came to his end.
5:28 And Lamech was a hundred and eighty-two years old when he had a son:
5:29 And he gave him the name of Noah, saying, Truly, he will give us rest from our trouble and the hard work of our hands,
because of the earth which was cursed by God.
5:30 And after the birth of Noah, Lamech went on living for five hundred and ninety-five years, and had sons and daughters:
5:31 And all the years of Lamech's life were seven hundred and seventy-seven: and he came to his end.
5:32 And Noah became the father of Shem, Ham, and Japheth.
Given two names described above,you must show me whether one man is the ancestor of another,and who lives longer.
输入格式
The input contains several lines.For each line ,there are two names described above.
输出格式
For each line of input,you should output two lines.
In the first line,output:
"Yes": If the first man is the ancestor of the second man "No": If the first man isn't the ancestor of the second man "No enough information": If the cited words above has no enough information In the second line,output:
"Yes" If the first man lived longer than the second man "No" If the first man didn't live longer than the second man "No enough information": If the cited words above has no enough information
样例输入
Adam SethShem Noah
样例输出
YesYesNoNo enough information
#include<stdio.h>#include<stdlib.h>#include<string.h>struct people {char name[20];int ancestor;int old;} xuan[13]= {{"Adam",1,930},{"Seth",2,912},{"Enosh",3,905},{"Kenan",4,910},{"Mahalalel",5,895},{"Jared",6,962},{"Enoch",7,365},{"Methuselah",8,969},{"Lamech",9,777},{"Noah",10,NULL},{"Shem",11,NULL},{"Ham",11,NULL},{"Japheth",11,NULL},};struct people u= {' ',-1,-1}, v= {' ',-1,-1}, p= {' ',-1,-1}, q= {' ',-1,-1};int main() {char x[20],y[20];int i;while(scanf("%s%s",&x,&y)!=EOF) {for(i=0; i<13; i++) {p=xuan[i];if(strcmp(p.name,x)==0) {u=p;break;}}for(i=0; i<13; i++) {q=xuan[i];if(strcmp(q.name,y)==0) {v=q;break;}}if(u.ancestor==NULL||v.ancestor==NULL)printf("No enough information\n");else if(u.ancestor<v.ancestor)printf("Yes\n");elseprintf("No\n");if(u.old==NULL||v.old==NULL)printf("No enough information\n");else if(u.old>v.old)printf("Yes\n");elseprintf("No\n");}return 0;}
- woj1003 - Birth of Noah
- WOJ1003-Birth of Noah
- WOJ 1003 - Birth of Noah
- Birth of a Seaver
- Growing Pains402 Birth of a Seaver
- WOJ-Problem 1003- birth of Noal
- XML Files - The Birth of Web Services 笔记 (一)
- XML Files - The Birth of Web Services 笔记 (二)
- 内存的诞生(The birth of Memory)
- faux louis vuitton Since the birth of Louis Vuitton
- [Bo's] Behind the scene stories of the birth of JavaScript
- Noah's ticket
- woj1004 - Noah's Ark
- WOJ1004-Noah's Ark
- 17.2: Apps that require users to share personal information, such as email address and date of birth
- 出生缺陷 birth defect
- The birth-death process
- js怎样连接birth报表
- MySQL分布式集群搭建
- Android 手机遥控器控制机顶盒(电视)
- Tensorflow05-激活函数、优化器、过拟合和Dropout
- Linux mysql5.7最精简安装方法 附带强制修改root密码方法
- Maven学习笔记 -- day01 Maven安装配置及测试
- WOJ1003-Birth of Noah
- git:解决本地多个ssh-key的问题
- nginx 安装
- php base64数据与图片的转换
- 跳石板
- 爬虫工程师和网络安全工程师的爱恨情仇
- 检查系统信息的简单脚本
- java处理json中的日期
- Unreal Engine 4添加自定义Settings到项目设置