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

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>
            一区二区三区四区五区在线| 一本色道88久久加勒比精品| 久久精品国产亚洲一区二区三区 | 亚洲欧美在线播放| 亚洲一区二区三区在线视频| 国产精品成人aaaaa网站| 亚洲欧美国产另类| 亚洲欧美成人网| 精品不卡视频| 亚洲高清不卡在线| 欧美日韩国内自拍| 午夜亚洲视频| 久久久久久免费| 99视频一区二区| 亚洲已满18点击进入久久| 国产日韩在线播放| 欧美激情第9页| 欧美日韩精品免费| 久久久精品五月天| 欧美精品三级日韩久久| 午夜精彩视频在线观看不卡| 欧美专区亚洲专区| 亚洲综合精品| 韩曰欧美视频免费观看| 欧美黄色精品| 国产美女精品人人做人人爽| 久久阴道视频| 欧美日韩一区二| 久久综合九色综合久99| 欧美日韩不卡在线| 久久久精品一品道一区| 欧美日韩一区精品| 女同性一区二区三区人了人一| 欧美人成在线| 裸体女人亚洲精品一区| 国产精品极品美女粉嫩高清在线 | 亚洲区一区二区三区| 国产精品久久一区主播| 欧美激情一区二区三区在线 | 欧美韩日高清| 久久久久久久综合狠狠综合| 欧美激情一区二区三区在线视频观看 | 国产一区二区三区四区hd| 亚洲国内精品| 在线欧美电影| 欧美亚洲在线播放| 亚洲综合色婷婷| 欧美区日韩区| 亚洲激情网站免费观看| 在线观看成人av| 欧美一级精品大片| 午夜精品在线观看| 欧美三级韩国三级日本三斤| 亚洲黄色免费电影| 尤物在线观看一区| 久久精品人人做人人综合| 午夜免费电影一区在线观看| 欧美日韩在线观看一区二区| 亚洲电影视频在线| 亚洲国产天堂网精品网站| 久久成人免费电影| 久久综合激情| 狠狠色伊人亚洲综合网站色| 午夜一区二区三区在线观看| 欧美一区二区三区免费视| 国产精品mm| 亚洲视频专区在线| 亚洲欧美视频一区| 国产精品欧美日韩久久| 在线综合亚洲| 午夜精品久久久久久久男人的天堂| 欧美日韩免费观看中文| 99精品久久免费看蜜臀剧情介绍| 亚洲乱码精品一二三四区日韩在线 | 久久久精品视频成人| 久久男人av资源网站| 黄色一区二区在线观看| 久久精品视频在线| 欧美激情欧美激情在线五月| 亚洲国产精品va在线看黑人| 免费亚洲网站| 99re6热只有精品免费观看| 亚洲午夜精品国产| 国产欧美精品一区二区色综合| 亚洲在线黄色| 免费成人av资源网| 99国产精品99久久久久久| 欧美肉体xxxx裸体137大胆| 亚洲欧美激情视频| 久久香蕉国产线看观看av| 久久婷婷人人澡人人喊人人爽| 久久嫩草精品久久久久| 亚洲国产高清aⅴ视频| 欧美日本一区二区高清播放视频| 日韩西西人体444www| 午夜日韩视频| 亚洲国产另类久久久精品极度| 欧美精品videossex性护士| 99精品欧美一区二区三区| 久久精品一区中文字幕| 91久久午夜| 国产欧美成人| 欧美人与禽猛交乱配| 亚洲欧美制服中文字幕| 欧美国产先锋| 午夜精品网站| 亚洲乱码国产乱码精品精| 国产精品一区在线观看你懂的| 久久精品系列| 在线中文字幕不卡| 欧美国产日韩a欧美在线观看| 在线亚洲精品| 韩国精品在线观看| 欧美日韩在线观看视频| 女主播福利一区| 欧美一级在线视频| 99视频一区| 91久久精品美女| 每日更新成人在线视频| 午夜国产不卡在线观看视频| 亚洲久久在线| 在线成人黄色| 国产日韩一区在线| 国产精品久久久免费| 欧美日本国产精品| 久久天堂av综合合色| 亚洲欧美伊人| 亚洲午夜精品一区二区三区他趣 | 99国产精品国产精品毛片| 黄色综合网站| 国产日韩三区| 国产伦精品一区二区三| 欧美视频导航| 欧美日韩亚洲激情| 欧美日韩精品系列| 欧美精品一区视频| 欧美11—12娇小xxxx| 快播亚洲色图| 久久米奇亚洲| 久久久91精品国产一区二区精品| 亚洲在线观看免费视频| 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 亚洲视频播放| 一区二区三区视频在线 | 激情六月综合| 国产真实乱子伦精品视频| 国产精品一区在线播放| 国产精品夜夜夜| 国产色综合久久| 国产无一区二区| 国产在线一区二区三区四区| 国产亚洲欧美另类一区二区三区| 国产丝袜美腿一区二区三区| 国产亚洲福利一区| 激情综合电影网| 亚洲人成免费| 一本色道久久综合精品竹菊| 亚洲视频日本| 欧美综合国产| 久久综合精品一区| 欧美激情精品久久久久久免费印度 | 国产在线精品一区二区中文| 国产在线视频欧美| 亚洲大片精品永久免费| 亚洲精选一区| 亚洲欧美制服另类日韩| 久久久久久久国产| 亚洲国产另类久久久精品极度| 亚洲国产精品成人综合色在线婷婷| 亚洲精品1区2区| 亚洲一二三区在线观看| 久久精品在线| 欧美精品激情在线观看| 国产精品久久久久久久第一福利| 国产欧美日韩精品一区| 亚洲国产日韩欧美在线99 | 亚洲视频网在线直播| 欧美亚洲综合久久| 欧美成人日本| 亚洲一二区在线| 久久夜色精品国产| 国产精品免费观看在线| 最新成人av网站| 欧美尤物一区| 亚洲人妖在线| 欧美影院在线| 欧美色另类天堂2015| 在线成人国产| 亚欧成人在线| 亚洲精选91| 久久久精品日韩欧美| 国产精品黄色| 日韩一级精品视频在线观看| 久久精品国产综合| 一本色道久久88精品综合| 久久久美女艺术照精彩视频福利播放 | 亚洲视频导航| 欧美日韩国产黄| 在线日韩中文字幕| 欧美一区二区视频在线|