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

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 閱讀(359) 評論(0)  編輯 收藏 引用 所屬分類: USACO


只有注冊用戶登錄后才能發(fā)表評論。
網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


導(dǎo)航

<2025年9月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

統(tǒng)計(jì)

常用鏈接

留言簿

隨筆分類

隨筆檔案

文章分類

文章檔案

搜索

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            中国女人久久久| 中日韩美女免费视频网站在线观看| 亚洲私人黄色宅男| 日韩视频久久| 亚洲美女中文字幕| 一本色道久久综合狠狠躁篇怎么玩 | 欧美四级剧情无删版影片| 久久亚洲国产精品一区二区| 销魂美女一区二区三区视频在线| 亚洲欧美日本精品| 久久久五月婷婷| 欧美激情一区二区三区蜜桃视频 | 裸体歌舞表演一区二区| 欧美激情精品久久久六区热门| 亚洲激情综合| 99re成人精品视频| 午夜欧美大尺度福利影院在线看| 亚洲欧美日韩国产综合| 欧美激情亚洲| 欧美精品三区| 免费在线国产精品| 亚洲欧美成人| 亚洲人成精品久久久久| 在线视频日韩精品| 亚洲美女网站| 欧美一区2区视频在线观看| 亚洲欧美精品| 欧美高清视频| 亚洲欧美日韩精品在线| 一本久久精品一区二区| 性娇小13――14欧美| 亚洲国产精品视频| 久久性色av| 欧美呦呦网站| 99这里只有精品| 欧美日韩国产成人在线观看| 国产精品二区影院| 亚洲激精日韩激精欧美精品| 亚洲综合丁香| 日韩午夜av| 免费观看在线综合色| 国产毛片一区| 亚洲午夜高清视频| 亚洲国产欧美一区二区三区久久| 亚洲一区不卡| 欧美日韩日本国产亚洲在线| 在线精品视频一区二区| 亚洲自啪免费| 日韩午夜av电影| 欧美大片在线影院| 亚洲国产欧美一区二区三区同亚洲| 欧美在线免费一级片| 宅男66日本亚洲欧美视频| 欧美极品一区| 亚洲三级影院| 久久夜色精品国产亚洲aⅴ| 亚洲视频精选在线| 欧美日韩亚洲免费| 日韩视频免费大全中文字幕| 久久精品国产综合精品| 亚洲在线一区二区三区| 国产精品扒开腿做爽爽爽视频| 一区二区三区www| 亚洲第一综合天堂另类专| 久久人人97超碰国产公开结果| 国产亚洲精品bv在线观看| 亚洲一区二区三区中文字幕| 妖精视频成人观看www| 欧美日韩和欧美的一区二区| 亚洲精品资源| 在线视频精品| 国产婷婷色一区二区三区| 久久久九九九九| 久久xxxx| 在线精品福利| 亚洲精品久久久久久久久久久| 欧美日韩精品二区| 亚洲欧美欧美一区二区三区| 亚洲欧美国产日韩中文字幕| 国产三级欧美三级| 免费欧美电影| 欧美日韩国产欧| 欧美日本中文| 亚洲午夜激情网站| 亚洲精品在线三区| 亚洲黄色影片| 日韩视频一区二区三区| 国产精品久久久一区二区| 欧美中文字幕在线视频| 久久网站热最新地址| 99视频在线观看一区三区| 亚洲永久精品大片| 亚洲国产精品va在线观看黑人 | 在线亚洲美日韩| 亚洲一级在线| 1024国产精品| 99riav国产精品| 激情亚洲成人| 午夜亚洲一区| 久热精品视频在线观看| 欧美高清视频免费观看| 久久狠狠久久综合桃花| 欧美电影在线观看| 亚洲一区二区影院| 久久久久久久综合日本| 亚洲影院免费观看| 免费亚洲电影在线| 久久久噜噜噜久久狠狠50岁| 欧美日韩大片一区二区三区| 久久一区激情| 国产欧美日韩视频一区二区三区| 亚洲大片在线| 国产亚洲一区二区在线观看| 亚洲精品色图| 亚洲人成网站在线观看播放| 亚洲综合国产激情另类一区| 亚洲国产精品综合| 久久大香伊蕉在人线观看热2| 一区二区三区日韩在线观看| 久久青草久久| 免费观看久久久4p| 国产一区日韩二区欧美三区| 亚洲人成在线观看网站高清| 尤物yw午夜国产精品视频明星| 在线亚洲国产精品网站| 亚洲精品乱码| 欧美激情精品久久久久久黑人| 久久香蕉国产线看观看网| 国产欧美日韩高清| 亚洲免费在线观看| 亚洲欧美视频在线观看视频| 欧美日韩精品一区| 艳女tv在线观看国产一区| 一区二区三区产品免费精品久久75| 免费欧美日韩| 亚洲黄一区二区| 99精品视频免费观看| 欧美福利影院| 日韩图片一区| 亚洲欧美久久| 国产午夜精品一区理论片飘花 | 免费91麻豆精品国产自产在线观看| 久久久免费av| 亚洲第一区在线观看| 午夜精品一区二区三区电影天堂| 一区二区三区欧美在线观看| 亚洲人成绝费网站色www| 欧美h视频在线| 亚洲日韩欧美视频一区| 一区二区三区高清视频在线观看| 欧美经典一区二区| 一区二区三区日韩精品| 久久av老司机精品网站导航| 国产日韩欧美在线一区| 久久精品免费看| 欧美黄色免费网站| 一区二区久久久久| 国产精品美女一区二区| 久久国产成人| 亚洲精品久久7777| 欧美一级片一区| 一区二区亚洲精品| 欧美精品色网| 欧美一区亚洲一区| 亚洲高清视频在线观看| 亚洲一区尤物| 亚洲高清一区二区三区| 欧美日韩午夜| 久久久久久久久久久久久9999| 亚洲国产视频一区| 欧美一区二区三区免费大片| 亚洲成人影音| 国产伦理一区| 欧美日韩一区二| 久久久久国色av免费观看性色| 亚洲国产清纯| 久久这里只有| 午夜精品久久久久久| 亚洲精品美女在线观看播放| 国产日韩在线看| 欧美视频网址| 男人的天堂亚洲| 久久不见久久见免费视频1| 亚洲日本中文字幕区| 久久精品综合一区| 中文国产成人精品| 亚洲国产aⅴ天堂久久| 国产麻豆午夜三级精品| 最新高清无码专区| 欧美人与禽性xxxxx杂性| 亚洲人成免费| 麻豆亚洲精品| 亚洲伊人伊色伊影伊综合网| 亚洲国产精品传媒在线观看| 国产欧美一区二区视频| 国产精品高潮呻吟久久av无限| 欧美高清免费| 美女精品自拍一二三四| 欧美一区中文字幕| 亚洲综合视频网|