Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * ride.cpp
- *
- * Created on: 25/10/2008
- * Author: Kuin
- */
- /*
- ID: iriarte1
- LANG: C++
- TASK: ride
- */
- #include <iostream>
- #include <string>
- #include <vector>
- #include <fstream>
- using namespace std;
- ifstream fin("ride.in");
- ofstream fout("ride.out");
- int main(){
- string cometa="ABSTAR";
- string grupo="USACO";
- fin >> cometa;
- fin >> grupo;
- int c,g;
- c=g=1;
- for(int i=0;i<cometa.size();i++) c*=cometa[i]-'A'+1;
- for(int i=0;i<grupo.size();i++) g*=grupo[i]-'A'+1;
- if(c%47==g%47) fout << "GO" << endl;
- else fout << "STAY" << endl;
- }
Add Comment
Please, Sign In to add comment