USACO 1.1 Your Ride Is Here

[报告]

   懂OI的人都能解决这道题目。

   一个字——“水”!

[程序]


#include <cstdlib>
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
ifstream fin ("ride.in");
ofstream fout ("ride.out");
string a,b;
long x,y;
int main(int argc, char *argv[])
{
    fin >> a;
    fin >> b;
    x=1;
    for (long i=0;i<a.length();i++)
        x=(x*(a[i]-'A'+1))%47;
    y=1;
    for (long i=0;i<b.length();i++)
        y=(y*(b[i]-'A'+1))%47;
    if (x==y) fout << "GO" << endl;
    else fout << "STAY" << endl;
   // system("PAUSE");
    return EXIT_SUCCESS;
}

 

posted @ 2009-12-11 09:44  为美好世界献上珂学  阅读(81)  评论(0)    收藏  举报