Guest User

Untitled

a guest
May 25th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. /*
  2. * ride.cpp
  3. *
  4. * Created on: 25/10/2008
  5. * Author: Kuin
  6. */
  7.  
  8. /*
  9. ID: iriarte1
  10. LANG: C++
  11. TASK: ride
  12. */
  13.  
  14. #include <iostream>
  15. #include <string>
  16. #include <vector>
  17. #include <fstream>
  18.  
  19. using namespace std;
  20.  
  21.  
  22. ifstream fin("ride.in");
  23. ofstream fout("ride.out");
  24.  
  25.  
  26. int main(){
  27.  
  28. string cometa="ABSTAR";
  29. string grupo="USACO";
  30.  
  31. fin >> cometa;
  32. fin >> grupo;
  33.  
  34. int c,g;
  35. c=g=1;
  36.  
  37. for(int i=0;i<cometa.size();i++) c*=cometa[i]-'A'+1;
  38. for(int i=0;i<grupo.size();i++) g*=grupo[i]-'A'+1;
  39.  
  40.  
  41. if(c%47==g%47) fout << "GO" << endl;
  42. else fout << "STAY" << endl;
  43.  
  44.  
  45.  
  46. }
Add Comment
Please, Sign In to add comment