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

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>
            久久国产精彩视频| 免费欧美日韩| 欧美国产日韩二区| 久久青草福利网站| 国产乱码精品一区二区三区av| 亚洲黄色片网站| 国内精品美女在线观看| 亚洲午夜精品在线| 亚洲主播在线播放| 欧美日韩视频在线一区二区观看视频| 免费日韩成人| 亚洲国产99| 久久午夜av| 欧美成人午夜激情视频| 亚洲大胆女人| 久久综合狠狠综合久久综合88| 久久久久在线观看| 一区二区在线视频| 久久久久五月天| 久久人体大胆视频| 激情另类综合| 玖玖精品视频| 亚洲激情在线观看| 99亚洲一区二区| 欧美日韩免费视频| 在线视频免费在线观看一区二区| 亚洲无限av看| 国产欧美日韩91| 欧美一区二区三区在线视频| 老妇喷水一区二区三区| 亚洲国产欧美一区二区三区同亚洲| 免费精品99久久国产综合精品| 亚洲电影专区| 欧美综合国产| 久久躁狠狠躁夜夜爽| 亚洲高清视频在线观看| 欧美精品色一区二区三区| 99国产精品视频免费观看| 午夜日韩视频| 一区在线影院| 欧美激情亚洲一区| 亚洲欧美日韩电影| 免费看成人av| 正在播放亚洲一区| 国产日韩亚洲欧美综合| 久久久欧美一区二区| 亚洲人成欧美中文字幕| 性欧美xxxx大乳国产app| 一区二区在线看| 欧美日韩一二三四五区| 欧美一区二区视频97| 亚洲国产成人tv| 欧美一区二区免费| 亚洲精品久久久久久久久久久| 国产精品久久久久久av下载红粉| 欧美一级在线视频| 亚洲欧洲日产国码二区| 欧美一区二区三区免费视| 在线成人免费观看| 国产精品xvideos88| 久久综合成人精品亚洲另类欧美| 一区二区免费看| 蜜臀av一级做a爰片久久| 亚洲永久在线| 亚洲黑丝在线| 国产婷婷精品| 欧美日韩在线播放一区二区| 久久久91精品国产| 亚洲一区二区三区成人在线视频精品| 免费日韩精品中文字幕视频在线| 亚洲欧美日韩一区二区三区在线| 亚洲国产精品嫩草影院| 国产欧美69| 欧美色综合天天久久综合精品| 久久久免费精品| 性欧美xxxx视频在线观看| 亚洲精品国产精品国自产观看浪潮| 久久精品中文| 校园春色国产精品| 一区二区三区精品| 另类亚洲自拍| 久久综合中文字幕| 亚洲男人第一网站| av72成人在线| 亚洲精品日产精品乱码不卡| 久久久久久电影| 久久成人一区| 午夜精品美女自拍福到在线| 一区二区三区国产| 亚洲清纯自拍| 亚洲国内精品在线| 亚洲电影在线观看| 在线成人www免费观看视频| 国产视频在线观看一区二区三区 | 免费永久网站黄欧美| 久久精品国产96久久久香蕉| 亚洲欧美国产精品va在线观看| 亚洲视频大全| 中文欧美日韩| 亚洲免费在线观看| 久久国内精品自在自线400部| 一区二区三区 在线观看视| 欧美大成色www永久网站婷| 午夜精品理论片| 欧美在线二区| 99视频精品全部免费在线| 亚洲激情女人| 日韩视频中文| 亚洲图片欧洲图片av| 中文亚洲视频在线| 亚洲欧美乱综合| 欧美自拍偷拍| 蜜桃伊人久久| 欧美刺激性大交免费视频| 欧美国产三区| 欧美日韩精品免费观看视频| 欧美视频一区| 国产一区成人| 亚洲成色最大综合在线| 亚洲人体大胆视频| 亚洲视频在线观看视频| 欧美亚洲综合另类| 久久综合伊人77777蜜臀| 欧美护士18xxxxhd| 一区二区免费看| 欧美一区二区三区视频在线| 久久久久成人精品| 欧美 日韩 国产在线| 国产午夜亚洲精品不卡| 久久嫩草精品久久久久| 久久久久国产精品一区三寸| 久久综合国产精品台湾中文娱乐网 | 另类亚洲自拍| 欧美日韩八区| 国产三级精品在线不卡| 亚洲国产成人午夜在线一区 | 亚洲一区视频| 老司机午夜精品视频| 日韩午夜激情av| 久久激情久久| 欧美色视频在线| 136国产福利精品导航网址应用| 一区二区三区免费看| 久久夜色精品国产欧美乱极品| 亚洲欧洲精品一区二区三区波多野1战4 | 国产精品免费看久久久香蕉| 激情成人中文字幕| 亚洲视频在线一区| 精品成人一区二区| 欧美不卡高清| 美女视频黄免费的久久| 免费影视亚洲| 国产精品综合久久久| 亚洲欧洲一二三| 久久精品综合一区| 这里只有精品电影| 欧美激情综合在线| 伊人久久大香线| 久久不射中文字幕| 99综合在线| 欧美成人免费在线观看| 狠狠色综合日日| 先锋影音国产一区| aⅴ色国产欧美| 欧美精品粉嫩高潮一区二区| 亚洲第一在线综合在线| 欧美在线中文字幕| 亚洲一区亚洲| 国产精品jvid在线观看蜜臀| 亚洲精品中文字| 亚洲第一精品夜夜躁人人爽| 欧美在线一区二区| 国产日韩欧美在线看| 亚洲欧美日韩中文视频| 日韩一区二区精品在线观看| 欧美精品成人91久久久久久久| 亚洲电影欧美电影有声小说| 免费在线观看日韩欧美| 葵司免费一区二区三区四区五区| 亚洲综合色丁香婷婷六月图片| 亚洲精品一级| 欧美风情在线观看| 久久蜜桃资源一区二区老牛| 国产日韩一区二区三区在线播放| 午夜视频一区| 亚洲一区二区三区在线| 国产精品日韩专区| 亚洲综合日韩在线| 亚洲无线视频| 美女诱惑黄网站一区| 欧美亚洲综合另类| 国外视频精品毛片| 免费在线成人| 欧美成人黑人xx视频免费观看| 最近中文字幕日韩精品| 亚洲精品欧美日韩专区| 欧美视频在线免费| 欧美一区激情| 久久蜜桃香蕉精品一区二区三区| 亚洲二区免费|