【2020年天梯赛校选赛】7-12 冰岛人

【2020年天梯赛校选赛】7-12 冰岛人

2018年世界杯,冰岛队因1:1平了强大的阿根廷队而一战成名。好事者发现冰岛人的名字后面似乎都有个“松”(son),于是有网友科普如下:

在这里插入图片描述
冰岛人沿用的是维京人古老的父系姓制,孩子的姓等于父亲的名加后缀,如果是儿子就加 sson,女儿则加 sdottir。因为冰岛人口较少,为避免近亲繁衍,本地人交往前先用个 App 查一下两人祖宗若干代有无联系。本题就请你实现这个 App 的功能。

输入格式:
在这里插入图片描述

输出格式:
对每一个查询,根据结果在一行内显示以下信息:
若两人为异性,且五代以内无公共祖先,则输出 Yes;
若两人为异性,但五代以内(不包括第五代)有公共祖先,则输出 No;
若两人为同性,则输出 Whatever;
若有一人不在名单内,则输出 NA。
所谓“五代以内无公共祖先”是指两人的公共祖先(如果存在的话)必须比任何一方的曾祖父辈分高。

输入样例:
15
chris smithm
adam smithm
bob adamsson
jack chrissson
bill chrissson
mike jacksson
steve billsson
tim mikesson
april mikesdottir
eric stevesson
tracy timsdottir
james ericsson
patrick jacksson
robin patricksson
will robinsson
6
tracy tim james eric
will robin tracy tim
april mike steve bill
bob adam eric steve
tracy tim tracy tim
x man april mikes

输出样例:
Yes
No
No
Whatever
Whatever
NA

#include<bits/stdc++.h>
using namespace std;
struct dot{
   
	int sex;
	string father;
};
map<string,dot>mp;
string fname,lname;
int judge(string s1,string s2){
   
	int i=1,j
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用内容,没有找到关于冰岛国旗的Python脚本或相关信息。但是,我可以为您提供一些关于如何在Python中绘制冰岛国旗的示例代码。 ```python import turtle # 设置画布大小 turtle.setup(600, 400) # 创建画笔 pen = turtle.Turtle() # 绘制蓝色背景 pen.penup() pen.goto(-300, 200) pen.pendown() pen.color("blue") pen.begin_fill() for _ in range(2): pen.forward(600) pen.right(90) pen.forward(200) pen.right(90) pen.end_fill() # 绘制红色横线 pen.penup() pen.goto(-300, 100) pen.pendown() pen.color("red") pen.begin_fill() pen.forward(600) pen.right(90) pen.forward(40) pen.right(90) pen.forward(600) pen.right(90) pen.forward(40) pen.end_fill() # 绘制白色横线 pen.penup() pen.goto(-300, 60) pen.pendown() pen.color("white") pen.begin_fill() pen.forward(600) pen.right(90) pen.forward(40) pen.right(90) pen.forward(600) pen.right(90) pen.forward(40) pen.end_fill() # 绘制红色横线 pen.penup() pen.goto(-300, 20) pen.pendown() pen.color("red") pen.begin_fill() pen.forward(600) pen.right(90) pen.forward(40) pen.right(90) pen.forward(600) pen.right(90) pen.forward(40) pen.end_fill() # 绘制白色横线 pen.penup() pen.goto(-300, -20) pen.pendown() pen.color("white") pen.begin_fill() pen.forward(600) pen.right(90) pen.forward(40) pen.right(90) pen.forward(600) pen.right(90) pen.forward(40) pen.end_fill() # 绘制红色横线 pen.penup() pen.goto(-300, -60) pen.pendown() pen.color("red") pen.begin_fill() pen.forward(600) pen.right(90) pen.forward(40) pen.right(90) pen.forward(600) pen.right(90) pen.forward(40) pen.end_fill() # 绘制红色竖线 pen.penup() pen.goto(-260, 200) pen.pendown() pen.color("red") pen.begin_fill() pen.forward(40) pen.right(90) pen.forward(200) pen.right(90) pen.forward(40) pen.right(90) pen.forward(200) pen.end_fill() # 绘制白色竖线 pen.penup() pen.goto(-220, 200) pen.pendown() pen.color("white") pen.begin_fill() pen.forward(40) pen.right(90) pen.forward(200) pen.right(90) pen.forward(40) pen.right(90) pen.forward(200) pen.end_fill() # 绘制红色竖线 pen.penup() pen.goto(-180, 200) pen.pendown() pen.color("red") pen.begin_fill() pen.forward(40) pen.right(90) pen.forward(200) pen.right(90) pen.forward(40) pen.right(90) pen.forward(200) pen.end_fill() # 隐藏画笔 pen.hideturtle() # 显示绘图窗口 turtle.done() ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值