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

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国产精品日本| 亚洲欧美视频一区| 激情视频一区二区| 亚洲国产精品电影| 国产精品白丝av嫩草影院| 小嫩嫩精品导航| 久久久久国色av免费看影院| 亚洲日韩欧美视频| 一区二区三区高清视频在线观看| 国产精品久久久久秋霞鲁丝| 久久久久久久成人| 欧美福利视频网站| 午夜在线精品偷拍| 久久影院亚洲| 亚洲午夜久久久久久久久电影网| 亚洲女同精品视频| 亚洲欧洲一区二区三区久久| 日韩一级二级三级| 韩日精品在线| 亚洲精品久久久一区二区三区| 国产精品久久久久毛片软件| 久久网站热最新地址| 欧美高清一区二区| 久久精品亚洲精品国产欧美kt∨| 蜜桃av一区二区三区| 亚洲欧美视频一区二区三区| 久久久久久久一区二区三区| 中日韩午夜理伦电影免费| 欧美一区二区三区视频| 一区二区高清在线观看| 久久久夜色精品亚洲| 亚洲欧美偷拍卡通变态| 蜜桃av噜噜一区二区三区| 新片速递亚洲合集欧美合集| 欧美α欧美αv大片| 久久免费视频一区| 国产精品国产三级国产| 亚洲第一页中文字幕| 国产最新精品精品你懂的| 一本大道久久a久久精品综合 | 亚洲精品乱码久久久久久黑人| 国产精品高潮久久| 亚洲第一网站免费视频| 国内精品福利| 亚洲欧美激情视频在线观看一区二区三区 | 免费观看在线综合| 国产视频亚洲精品| 亚洲视频一区二区免费在线观看| 亚洲精品一区二区三区不| 久久亚洲私人国产精品va媚药| 亚洲欧美综合网| 欧美激情久久久| 欧美高清在线视频观看不卡| 在线成人中文字幕| 久久激情一区| 久久久久成人网| 国产一区白浆| 欧美一区国产一区| 久久精品一本| 国内视频一区| 久久亚洲电影| 免费日韩av| 亚洲欧洲日本专区| 欧美大秀在线观看| 亚洲人午夜精品| 99riav国产精品| 欧美日韩亚洲一区| 99视频有精品| 亚洲香蕉在线观看| 国产精品欧美在线| 校园激情久久| 欧美a级大片| 亚洲欧洲精品一区二区三区波多野1战4 | 久久午夜影视| 亚洲高清自拍| 欧美精品v日韩精品v国产精品| 亚洲高清视频一区| 亚洲午夜激情网页| 国产精品亚洲综合色区韩国| 香蕉久久国产| 欧美大尺度在线| 夜夜嗨av一区二区三区网站四季av| 欧美区一区二| 亚洲一区在线观看免费观看电影高清 | 欧美激情一区在线| 99在线|亚洲一区二区| 欧美亚洲免费电影| 极品中文字幕一区| 欧美激情一区二区三区四区| 一本色道婷婷久久欧美| 午夜亚洲视频| 激情久久五月天| 欧美日韩国产综合一区二区| 一区二区三区视频在线| 久久国产加勒比精品无码| 在线精品亚洲一区二区| 欧美精品国产一区| 香蕉亚洲视频| 亚洲精品久久久久久久久久久久久| 亚洲一卡久久| 亚洲成色最大综合在线| 欧美日韩精品免费| 久久久噜噜噜久久| 亚洲最新在线| 欧美成人精品一区| 亚洲一区二区三区四区中文 | 国产精品美腿一区在线看| 久久久噜噜噜久久| 在线一区免费观看| 欧美成人69| 欧美一区二区日韩一区二区| 亚洲精品护士| 在线成人h网| 国产精品日韩在线一区| 欧美精品亚洲一区二区在线播放| 亚洲欧美在线aaa| 亚洲理论在线| 美女国产一区| 久久成人在线| aⅴ色国产欧美| 亚洲人www| 在线观看中文字幕不卡| 国产精品亚洲综合天堂夜夜| 欧美精品情趣视频| 免费高清在线视频一区·| 亚洲欧美在线播放| 亚洲一区二区三区国产| av成人天堂| 亚洲精品日韩在线| 亚洲激情电影在线| 亚洲国产成人一区| 欧美freesex8一10精品| 久久一区中文字幕| 久久久夜精品| 久久精品视频播放| 亚欧成人精品| 欧美一区二区日韩一区二区| 亚洲一区久久| 亚洲综合首页| 午夜视频精品| 性色一区二区三区| 欧美一区2区三区4区公司二百| 亚洲永久在线| 亚洲欧美日韩直播| 亚洲欧美激情在线视频| 亚洲在线一区二区三区| 一区二区三区四区五区精品| 日韩视频一区二区三区在线播放免费观看| 亚洲国产影院| 亚洲伦伦在线| 亚洲视频你懂的| 销魂美女一区二区三区视频在线| 亚洲欧美一区在线| 先锋影音网一区二区| 久久九九电影| 欧美成人免费视频| 91久久久国产精品| 中文欧美在线视频| 午夜精品久久久久| 久久久亚洲综合| 欧美电影免费| 欧美日韩一区二区在线播放| 国产精品扒开腿做爽爽爽视频| 国产欧美视频在线观看| 在线观看一区二区精品视频| 日韩视频在线免费观看| 香蕉久久夜色精品国产使用方法| 久久精品欧美日韩| 欧美多人爱爱视频网站| 亚洲美女诱惑| 亚洲图片欧美一区| 久久久免费av| 欧美日韩国产成人在线| 国产午夜亚洲精品不卡| 在线精品视频一区二区三四| 一道本一区二区| 欧美在线看片a免费观看| 免费视频一区| 这里是久久伊人| 久久九九电影| 欧美深夜福利| 亚洲黄色免费电影| 欧美在线免费看| 亚洲狼人综合| 久久久综合香蕉尹人综合网| 欧美午夜一区二区福利视频| 亚洲福利在线看| 欧美一二三区精品| 亚洲激情视频在线观看| 欧美中文字幕久久| 国产精品国产三级国产aⅴ无密码| 亚洲国产成人精品视频| 欧美在线观看视频一区二区|