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

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


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


導(dǎo)航

<2025年12月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

統(tǒng)計

常用鏈接

留言簿

隨筆分類

隨筆檔案

文章分類

文章檔案

搜索

最新評論

閱讀排行榜

評論排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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精品欧美一区二区蜜桃免费| 欧美高清在线视频| 一区二区日韩免费看| 亚洲伦理在线免费看| 国产精品国产三级国产专区53| 亚洲自拍偷拍网址| 午夜国产精品视频免费体验区| 国产在线精品二区| 亚洲电影激情视频网站| 欧美激情四色| 午夜亚洲一区| 另类激情亚洲| 在线视频精品一区| 欧美在线日韩精品| 亚洲国产你懂的| 一本大道久久a久久综合婷婷| 国产精品欧美在线| 欧美成人精品不卡视频在线观看| 欧美福利视频| 久久成人精品| 免费国产自线拍一欧美视频| 中文国产一区| 久久综合999| 亚洲欧美三级伦理| 美女久久网站| 欧美在线播放一区| 欧美高清视频一区| 久久久午夜精品| 欧美日韩亚洲一区二区三区在线观看| 欧美一区二区三区四区在线| 欧美成人精品| 久久黄色级2电影| 欧美久久影院| 久久综合色一综合色88| 欧美日本网站| 欧美freesex交免费视频| 国产精品www色诱视频| 欧美高清hd18日本| 国产嫩草一区二区三区在线观看| 欧美激情一区二区| 国产欧美一区二区精品性| 亚洲激情网站免费观看| 亚洲欧美日韩国产综合在线 | 亚洲影视在线| 91久久久久| 久久国产色av| 欧美一区二区三区免费大片| 欧美日韩黄视频| 亚洲国产精品va在线看黑人| 黄色综合网站| 欧美一区二区三区在线观看视频| 亚洲网友自拍| 欧美裸体一区二区三区| 欧美国产欧美亚州国产日韩mv天天看完整| 国产精品日韩精品| 亚洲网友自拍| 亚洲欧美成人| 欧美午夜视频在线| 9色国产精品| 亚洲视频日本| 欧美午夜一区二区三区免费大片 | 欧美在线亚洲| 国产免费观看久久| 亚洲欧美日产图| 欧美一区二区三区免费观看视频| 欧美体内she精视频在线观看| 91久久精品国产91性色| 亚洲精品国产精品乱码不99 | 欧美成人xxx| 欧美成人有码| 亚洲日本电影| 欧美国产在线电影| 亚洲欧洲一区二区三区在线观看 | 黄色成人在线网址| 亚洲国产经典视频| 亚洲精选国产| 国产精品av久久久久久麻豆网| 一二三四社区欧美黄| 在线看国产一区| 欧美国产日韩亚洲一区| 亚洲日韩欧美视频一区| 亚洲视频一区| 国产伦精品一区二区三区高清版 | 日韩视频在线一区二区| 亚洲影院免费观看| 国产视频精品va久久久久久| 久久精品日产第一区二区| 欧美91大片| 亚洲天堂视频在线观看| 国产日韩欧美日韩大片| 久久久爽爽爽美女图片| 亚洲人成精品久久久久| 亚洲欧美日韩国产综合在线 | 欧美激情一区二区三区成人| 一区二区三区高清在线| 久久精品国产在热久久| 亚洲精品视频在线| 国产精品久久久久久久第一福利| 久久成人在线| 亚洲区欧美区| 久久久精品国产免大香伊| 亚洲经典一区| 国产欧美日韩视频在线观看| 欧美搞黄网站| 午夜精品一区二区三区在线| 欧美激情一区二区三区| 午夜亚洲视频| 亚洲精品日韩综合观看成人91| 国产伦精品一区二区三| 欧美国产日本韩| 欧美一区二区在线看| 日韩亚洲欧美一区| 欧美成人精品高清在线播放| 亚洲欧美日韩综合aⅴ视频| 亚洲区一区二| 国产亚洲制服色| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ入口 | 午夜欧美精品| 亚洲免费观看视频| 影音先锋久久| 国产一区二区三区自拍| 欧美日精品一区视频| 你懂的国产精品| 欧美一级专区免费大片| 一本色道**综合亚洲精品蜜桃冫| 欧美电影免费观看大全| 久久久无码精品亚洲日韩按摩| 亚洲永久精品大片| 亚洲特色特黄| 亚洲图片激情小说| 亚洲美女啪啪| 亚洲肉体裸体xxxx137| 在线成人黄色| 一色屋精品视频免费看| 国产亚洲综合在线| 国产视频一区在线| 国产视频一区二区在线观看| 国产精品美腿一区在线看| 欧美日韩午夜精品| 国产精品v欧美精品v日韩精品 | 久久精品一区四区| 亚洲欧美日韩中文播放| 亚洲视频一区在线观看| 9l国产精品久久久久麻豆| 亚洲乱码视频| 日韩午夜激情av| 一本色道久久综合亚洲91| 日韩亚洲国产精品| 一区二区三区导航| 亚洲午夜电影| 亚洲欧美激情精品一区二区| 亚洲午夜一区二区三区| 亚洲综合视频1区| 久久成人免费视频| 美日韩精品免费| 欧美国产精品| 欧美午夜欧美| 国产一区二区三区免费观看| 韩国一区二区三区美女美女秀| 黑人巨大精品欧美黑白配亚洲| 国内精品免费在线观看| 亚洲人成在线播放| 一本一本a久久| 欧美夜福利tv在线| 另类天堂视频在线观看| 亚洲国产精品va在线看黑人动漫| 91久久精品国产91久久性色| 这里只有视频精品| 欧美在线视频二区| 欧美不卡视频一区| 欧美日韩中文在线观看| 国产日韩欧美一区在线| 亚洲丶国产丶欧美一区二区三区| 亚洲精品一区在线观看香蕉| 亚洲欧美日韩另类| 免费观看一区| 一区二区三区成人| 久久久国产精品一区| 欧美日韩免费视频| 国产亚洲一级高清| 9久草视频在线视频精品| 欧美一区午夜精品| 亚洲精品国产精品国自产在线| 午夜一区二区三视频在线观看| 久久免费99精品久久久久久| 欧美亚洲成人免费| 最新热久久免费视频| 欧美一级淫片播放口| 亚洲国产一区二区三区青草影视| 午夜欧美理论片| 欧美精品在线免费播放| 精品88久久久久88久久久| 亚洲欧美日韩成人高清在线一区| 老色批av在线精品| 亚洲自拍另类| 欧美日韩亚洲91|