题目信息

题目类型
练习
题目年份
2025
题目题型
编程题
关 键 词
你要乘坐的飞碟在这里

题目题干

你要乘坐的飞碟在这里

一个众所周知的事实,在每一慧星后面是一个不明飞行物UFO。 这些不明飞行物时常来收集来自在地球上忠诚的支持者。 不幸地,他们的空间在每次旅行只能带上一群支持者。 他们要做的是用一种聪明的方案让每一个团体人被慧星带走。 他们为每个慧星起了一个名字,通过这些名字来决定一个团体是不是特定的慧星带走。 那个相配方案的细节在下面被给出; 你的工作要写一个程序来通过团体的名字和彗星的名字来决定一个组是否应该与在那一颗慧星后面的不明飞行物搭配。 团体的名字和慧星的名字都以下列各项方式转换成一个数字: 这个最后的数字代表名字中所有字母的信息,"A" 是 1 和 "Z" 是 26。 举例来说,团体 "USACO" 会是 21191315=17955 。 如果团体的数字 mod 47 等于慧星的数字 mod 47,那么你要告诉这个团体准备好被带走 ! 写一个程序读入慧星的名字和团体的名字,如果搭配打印"GO"否则打印"STAY"团体的名字和慧星的名字将会是没有空格或标点的一串大写字母(不超过6个字母) Examples: Input Output COMETQ HVNGAT GO ABSTAR USACO STAYvhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

输入

第 1 行:彗星的名字(一个长度为1到6的字符串) 第 2 行:团体的名字(一个长度为1到6的字符串)vhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

输出

单独一行包含"STAR"或"GO".vhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

样例

输入

COMETQ 
HVNGAT

输出

GO

提示

Your Ride Is Here It is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up one group of followers on each trip. They do, however, let the groups know ahead of time which will be picked up for each comet by a clever scheme: they pick a name for the comet which, along with the name of the group, can be used to determine if it is a particular group's turn to go (who do you think names the comets?). The details of the matching scheme are given below; your job is to write a program which takes the names of a group and a comet and then determines whether the group should go with the UFO behind that comet. Both the name of the group and the name of the comet are converted into a number in the following manner: the final number is just the product of all the letters in the name, where "A" is 1 and "Z" is 26. For instance, the group "USACO" would be 21 19 15 = 17955. If the group's number mod 47 is the same as the comet's number mod 47, then you need to tell the group to get ready! (Remember that "a mod b" is the remainder left over after dividing a by b; 34 mod 10 is 4.) Write a program which reads in the name of the comet and the name of the group and figures out whether according to the above scheme the names are a match, printing "GO" if they match and "STAY" if not. The names of the groups and the comets will be a string of capital letters with no spaces or punctuation, up to 6 characters long.vhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

Examples: Input Output COMETQ HVNGAT GOvhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
ABSTAR USACO STAYvhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

PROGRAM NAME: ridevhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

INPUT FORMAT Line 1: An upper case character string of length 1..6 that is the name of the comet.vhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库
Line 2: An upper case character string of length 1..6 that is the name of the group.vhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

NOTE: The input file has a newline at the end of each line but does not have a "return". Sometimes, programmers code for the Windows paradigm of "return" followed by "newline"; don't do that! Use simple input routines like "readln" (for Pascal) and, for C/C++, "fscanf" and "fid>>string".vhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

SAMPLE INPUT (file ride.in) COMETQ HVNGATvhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

OUTPUT FORMAT A single line containing either the word "GO" or the word "STAY".vhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

SAMPLE OUTPUT (file ride.out) GOvhB100150满分答卷(100150.com)-青少年编程等级考试及竞赛题库

答案解析

相关题目

贪婪的礼物送礼者 对于一群要互送礼物的朋友,你要确定每个人送出的礼物比收到的多多少。在这一个问题中,每个人都准备了一些钱来送礼物,而这些钱将会被平均分给那些将收到他的礼物的人。然而,在任何一群朋友中,
你要乘坐的飞碟在这里 一个众所周知的事实,在每一慧星后面是一个不明飞行物UFO。 这些不明飞行物时常来收集来自在地球上忠诚的支持者。 不幸地,他们的空间在每次旅行只能带上一群支持者。 他们要做的是用一
删除数组中的元素 题目描述 给定N个整数,将这些整数中与M相等的删除 假定给出的整数序列为:1,3,3,0,-3,5,6,8,3,10,22,-1,3,5,11,20,100,3,9,3 应该将其放在
统计学生信息 ​​​​​​​题目描述 利用动态链表记录从标准输入输入的学生信息(学号、姓名、性别、年龄、得分、地址) 其中,学号长度不超过20, 姓名长度不超过40, 性别长度为1, 地址长度不超过
等待服务 题目描述 n个人的队伍,其中第i个人需要t[i]分钟来服务,期间后面的人就要等着。如果一个人等待的时间大于了他被服务的时间,他就会失望。你的任务是重排队伍,使失望的人尽量的少,并只需输出不
CPU任务 题目描述 CPU通过循环调度法逐一处理任务,每个任务最多处理q毫秒(这个时间称为时间片)。如果q毫秒之后任务尚未处理完毕,那么该任务将被移动至队伍最末尾,CPU随即开始处理下一个任务。
瓶子和燃料 题目描述 jyy就一直想着尽快回地球,可惜他飞船的燃料不够了。 有一天他又去向火星人要燃料,这次火星人答应了,要jyy用飞船上的瓶子来换。jyy 的飞船上共有 N个瓶子(1<=N&
切比雪夫距离 题目描述 小C有一个平面! 它发现了平面上的两个点,请你求出求它们之间的切比雪夫距离。切比雪夫距离定义为x与y方向坐标差的绝对值较大值。 输入 四个整数,a,b,c,d。坐标为(a
横式竖式计算 题目描述 输入两个数,分别打印这两个数的横式和竖式运算式子。 输入 输入两个整数a,b 以空格隔开 输出 第一行打印横式运算式子,接下来四行打印竖式运算式子 样例输入  45 23
四舍五入 题目描述 将一个整数,四舍五入 12345->12350 12399->12400 输入 一个整数n 输出 一个整数m 样例输入  99 样例输出  100 提示 0

提示声明

  • 免责声明:本站资源均来自网络或者用户投稿,仅供用于学习和交流:如有侵权联系删除!
  • 温馨提示:本文属于积分文章,需要充值获得积分或升级VIP会员,也可在会员中心投稿获取。

猜你喜欢