青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

USACO Section 1.1 Your Ride Is Here

 

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 * 1 * 3 * 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.

Examples:

 

Input Output
COMETQ
            HVNGAT
            
GO
ABSTAR
            USACO 
STAY

 

PROGRAM NAME: ride

INPUT FORMAT

Line 1: An upper case character string of length 1..6 that is the name of the comet.
Line 2: An upper case character string of length 1..6 that is the name of the group.

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".

SAMPLE INPUT (file ride.in)

COMETQ
HVNGAT

OUTPUT FORMAT

A single line containing either the word "GO" or the word "STAY".

SAMPLE OUTPUT (file ride.out)

My solution:
 1 #include <iostream>
 2 #include <string>
 3 using namespace std;
 4 #define LOCAL
 5 int main()
 6 {
 7 #ifdef LOCAL
 8  freopen("ride.in""r", stdin);
 9  freopen("ride.out""w", stdout);
10 #endif
11  int iVal1, iVal2;
12  string Str1, Str2;
13  
14  while(cin >> Str1 >> Str2)
15  {
16   iVal1 = 1;
17   iVal2 = 1;
18   for(int i = 0; i < Str1.length(); i++)
19   {
20    iVal1 *= (Str1[i] - 'A' + 1);
21    iVal1 %= 47;
22   }
23   for(int i = 0; i < Str2.length(); i++)
24   {
25    iVal2 *= (Str2[i] - 'A' + 1);
26    iVal2 %= 47;
27   }
28   if(iVal1 == iVal2) printf("GO\n");
29   else printf("STAY\n");
30  }
31  return 0;
32 }


posted on 2009-07-27 00:51 Philip85517 閱讀(370) 評論(0)  編輯 收藏 引用 所屬分類: USACO


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


導航

<2025年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

統計

常用鏈接

留言簿

隨筆分類

隨筆檔案

文章分類

文章檔案

搜索

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲——在线| 快射av在线播放一区| 亚洲毛片播放| 欧美日产国产成人免费图片| 亚洲免费电影在线| 一本色道久久综合狠狠躁篇的优点| 欧美区一区二区三区| 亚洲午夜一区二区| 亚洲欧美国产一区二区三区| 国内精品写真在线观看| 欧美不卡一区| 欧美日本久久| 亚洲资源在线观看| 欧美在线视频一区| 尤物视频一区二区| 99国产精品久久久久久久久久 | 亚洲激情婷婷| 欧美日韩一区高清| 久久久亚洲人| 欧美美女福利视频| 欧美一区国产一区| 欧美高清视频一区二区三区在线观看| 99这里只有久久精品视频| 亚洲视频在线观看三级| 国内精品久久久久伊人av| 亚洲欧洲精品一区二区三区波多野1战4| 欧美日韩在线一区| 美女亚洲精品| 国产精品久久波多野结衣| 蜜桃av噜噜一区| 欧美亚一区二区| 欧美成人综合在线| 国产欧美1区2区3区| 亚洲第一色在线| 国产日本欧洲亚洲| 一本大道av伊人久久综合| 精品99视频| 亚洲欧美一区二区视频| 一本综合久久| 美女精品国产| 久热精品视频在线| 国产情侣一区| 一个色综合导航| 亚洲精选国产| 美女视频黄a大片欧美| 久久精品亚洲乱码伦伦中文 | 久久久久欧美| 欧美一区三区二区在线观看| 欧美欧美全黄| 亚洲福利视频在线| 一区二区视频免费在线观看| 亚洲一区3d动漫同人无遮挡| 亚洲神马久久| 欧美日韩国产黄| 亚洲人成艺术| 日韩午夜黄色| 欧美高清视频一区二区三区在线观看 | 久久综合导航| 另类图片综合电影| 在线看片日韩| 久久婷婷国产综合国色天香 | 亚洲国产精品久久久久秋霞蜜臀| 亚洲免费视频成人| 欧美亚洲在线播放| 国产精品入口麻豆原神| 亚洲一区二区黄| 久久岛国电影| 国产综合亚洲精品一区二| 欧美影院视频| 麻豆国产va免费精品高清在线| 国产亚洲一本大道中文在线| 欧美在线观看日本一区| 久久久久在线观看| 亚洲第一级黄色片| 老司机aⅴ在线精品导航| 欧美激情亚洲国产| 日韩一级不卡| 国产精品嫩草影院av蜜臀| 亚洲欧美日韩成人高清在线一区| 久久精品国产999大香线蕉| 国产在线成人| 欧美国产亚洲精品久久久8v| 亚洲伦伦在线| 欧美在线地址| 亚洲第一色中文字幕| 欧美精品九九| 亚洲一区在线观看视频| 久久综合久久88| 一区二区欧美在线| 国产欧美日韩一区二区三区在线观看 | 欧美大片免费| 亚洲一级在线| 国产一区二区三区视频在线观看| 久久一区二区三区超碰国产精品| 亚洲激情成人网| 午夜精品久久久久| 亚洲国产欧美在线人成| 欧美日韩一区二区三区在线看| 亚洲免费婷婷| 亚洲国产精品ⅴa在线观看| 亚洲欧美电影在线观看| 在线观看日韩av先锋影音电影院| 欧美精品色综合| 久久成人一区| 一本色道久久综合亚洲二区三区| 久久久综合精品| 亚洲一区二区动漫| 亚洲高清视频在线观看| 国产精品久久久久久久久免费| 久久婷婷色综合| 亚洲免费在线视频| 最新69国产成人精品视频免费| 久久久91精品国产| 亚洲一区3d动漫同人无遮挡| 在线观看日韩| 国产一区二区三区久久| 欧美日韩美女一区二区| 狼狼综合久久久久综合网 | 日韩一区二区精品| 男人的天堂成人在线| 午夜精品久久久久久久99樱桃 | 1204国产成人精品视频| 国产精品美女www爽爽爽| 欧美国产国产综合| 久久综合色婷婷| 欧美在线视频a| 亚洲视频高清| 一区二区三区日韩欧美精品| 亚洲国产日韩欧美在线动漫| 久久影视精品| 久久全球大尺度高清视频| 亚洲欧美另类中文字幕| 中文国产成人精品久久一| 亚洲欧洲日本mm| 亚洲国产精品嫩草影院| 亚洲成人在线视频播放| 韩国成人精品a∨在线观看| 国产日韩一级二级三级| 国产欧美日韩精品专区| 国产精品视频区| 国产精品欧美久久| 国产精品捆绑调教| 国产精品久久国产三级国电话系列| 欧美日韩国产成人在线91| 欧美另类极品videosbest最新版本| 欧美电影免费观看高清| 欧美精品一区二区三区在线看午夜 | 久久精品首页| 久久久午夜视频| 毛片基地黄久久久久久天堂| 美女视频黄a大片欧美| 欧美成在线视频| 亚洲精品欧美专区| 一区二区电影免费在线观看| 亚洲一区二区三区在线视频| 亚洲欧美变态国产另类| 欧美与黑人午夜性猛交久久久| 久久不射网站| 欧美国产视频在线观看| 欧美视频精品在线| 国产欧美一区二区精品性| 激情亚洲一区二区三区四区| 亚洲精品久久久久久下一站 | 最新国产成人在线观看| 99视频一区二区| 欧美一区二粉嫩精品国产一线天| 久久国产精品色婷婷| 蜜月aⅴ免费一区二区三区| 91久久精品美女| 亚洲午夜精品久久| 久久久人人人| 欧美日韩一区高清| 国产一二三精品| 日韩视频第一页| 久久精品72免费观看| 亚洲第一福利社区| 亚洲天堂男人| 另类图片综合电影| 国产精品美腿一区在线看 | 国产精品爽黄69| 亚洲经典视频在线观看| 亚洲欧美一区二区视频| 久久婷婷国产麻豆91天堂| 最新高清无码专区| 欧美在线不卡| 欧美日韩在线播| 亚洲国产成人不卡| 亚洲欧美精品中文字幕在线| 免费在线看成人av| 亚洲欧美激情一区| 欧美人与禽性xxxxx杂性| 黑丝一区二区| 午夜久久久久| 日韩一区二区福利| 欧美11—12娇小xxxx| 国产精品网站一区| 亚洲视频综合在线| 亚洲国产精品久久久久| 欧美在线视频不卡| 国产女精品视频网站免费|