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

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 閱讀(366) 評論(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>
            99精品欧美一区二区三区| 国产精品亚洲第一区在线暖暖韩国| 91久久精品国产91久久性色tv | 亚洲免费观看高清完整版在线观看| 久热re这里精品视频在线6| 美女图片一区二区| 亚洲国产一区二区三区a毛片| 理论片一区二区在线| 午夜精品久久久久久久久久久久久| 亚洲影院免费观看| 国产精品日本精品| 欧美日韩免费网站| 亚洲一区二区三区在线| 欧美在线视频导航| 精品91久久久久| 麻豆精品在线播放| 一本到12不卡视频在线dvd| 午夜老司机精品| 激情文学一区| 国产美女一区| 欧美国产日韩一区二区在线观看| 日韩视频在线播放| 欧美在线影院在线视频| 亚洲一区二区三区四区五区午夜| 激情伊人五月天久久综合| 国产欧美在线看| 欧美大片免费久久精品三p| 亚洲网址在线| 欧美大片91| 亚洲欧美日韩国产成人精品影院 | 香蕉久久夜色精品| 亚洲国产精品欧美一二99| 欧美丝袜一区二区三区| 久久精品91久久香蕉加勒比| 亚洲大胆av| 欧美激情1区2区3区| 蜜桃av一区二区在线观看| 狂野欧美一区| 欧美a级片网站| 久久精品人人做人人爽| 99精品久久免费看蜜臀剧情介绍| 99re6热只有精品免费观看 | 久久综合国产精品| 久久婷婷国产麻豆91天堂| 亚洲一区二区三区视频播放| 亚洲欧美电影在线观看| 亚洲精品欧美| 99综合在线| 一色屋精品亚洲香蕉网站| 国产精品www.| 免费不卡视频| 欧美理论电影在线播放| 久久久久久久一区二区三区| 在线午夜精品| 亚洲人体偷拍| 99国内精品久久| 亚洲男人影院| 久久久久久9| 欧美激情综合| 蜜臀久久久99精品久久久久久| 欧美成人精品一区| 欧美色综合天天久久综合精品| 国产精品视频一区二区高潮| 激情久久久久久久| 99热精品在线观看| 欧美伊人精品成人久久综合97| 在线亚洲免费视频| 亚洲精品综合| 亚洲欧美中文字幕| 麻豆精品视频在线观看| 久久免费视频一区| 亚洲欧美国产三级| 免费观看日韩av| 亚洲毛片在线免费观看| 午夜久久tv| 欧美一级欧美一级在线播放| 亚洲一区二区在线播放| 久久久久国产一区二区| 欧美日韩中文字幕在线视频| 国语精品一区| 国产一区二区三区日韩| 国产色综合久久| 国产农村妇女精品一二区| 亚洲第一在线综合网站| 亚洲成人在线网站| 亚洲午夜精品久久久久久浪潮| 久久精品麻豆| 性色一区二区| 亚洲高清激情| 欧美va亚洲va国产综合| 欧美黑人在线观看| 亚洲激情成人网| 亚洲精品免费在线播放| 欧美中文字幕在线播放| 久久久久久久久岛国免费| 欧美视频日韩视频| 亚洲国产成人午夜在线一区| 香蕉亚洲视频| 亚洲精品在线视频观看| 久久久亚洲高清| 国产精品午夜视频| 亚洲精品乱码久久久久久| 亚洲开发第一视频在线播放| 久久精品国产77777蜜臀 | 一区二区电影免费观看| 亚洲欧美一区在线| 欧美日韩免费一区| 亚洲福利视频在线| 欧美综合二区| 亚洲一卡久久| 欧美日韩一区二区在线观看视频 | 中文日韩电影网站| 欧美极品在线视频| 亚洲高清不卡| 免费永久网站黄欧美| 欧美在线免费观看视频| 国产女人18毛片水18精品| 亚洲欧美激情诱惑| 一区二区欧美国产| 欧美日韩免费观看一区| 亚洲美女网站| 亚洲精品123区| 免费观看成人www动漫视频| 禁久久精品乱码| 久久―日本道色综合久久| 午夜精品久久久久久久久久久久久| 国产精品成人观看视频免费| 国产亚洲欧美激情| 欧美一区三区二区在线观看| 亚洲一区3d动漫同人无遮挡| 欧美日韩黄视频| 黄色欧美日韩| 久久精品欧洲| 欧美伊人久久大香线蕉综合69| 国产欧美日韩精品一区| 亚洲欧美99| 亚洲欧美成人一区二区三区| 国产精品丝袜久久久久久app| 亚洲综合欧美| 亚洲少妇最新在线视频| 国产精品久久久久久av下载红粉| 亚洲在线视频| 亚洲欧美日韩国产成人| 国产亚洲一区二区三区| 久久综合狠狠综合久久综合88| 一区二区三区波多野结衣在线观看| 欧美日韩国产色综合一二三四 | 亚洲日本理论电影| 欧美日本中文| 亚洲一区二区免费| 亚洲资源av| 国产专区欧美精品| 亚洲午夜伦理| 亚洲一区二区3| 国产欧美在线观看一区| 久热精品在线视频| 欧美成人中文字幕| 亚洲视屏在线播放| 欧美激情四色| 欧美日韩p片| 亚洲欧美制服另类日韩| 欧美一级在线播放| 亚洲国产精品一区二区久| 亚洲精品国产精品国自产观看| 国产精品成人久久久久| 久久精品国产99国产精品| 久久在线免费视频| 99精品久久免费看蜜臀剧情介绍| 一区二区三区四区五区视频| 国产亚洲精品久| 亚洲福利av| 国产精品免费视频观看| 亚洲免费在线| 欧美在线视频一区二区| 亚洲国产一区二区三区a毛片| 一本色道久久88综合日韩精品| 国产欧美一区二区三区久久人妖 | 最新日韩欧美| 亚洲图片欧美日产| 精品成人一区二区| 99re66热这里只有精品4| 国产亚洲精久久久久久| 亚洲第一页中文字幕| 国产精品国产三级国产aⅴ浪潮| 久久午夜av| 欧美日韩国产在线播放网站| 久久精品日韩欧美| 欧美精品一线| 久久久久久夜| 欧美日韩国产影院| 麻豆91精品91久久久的内涵| 欧美日韩中文字幕日韩欧美| 久久综合网hezyo| 欧美网站大全在线观看| 欧美成人视屏| 国产精品网站在线| 欧美激情第三页| 国产日韩专区在线| 亚洲精品自在久久| 亚洲福利在线观看|