-
your ride is here c++ALGORITHM/USACO 2019. 8. 11. 02:08728x90
#include <iostream> #include <fstream> #include <string> using namespace std; int main() { ofstream fout("ride.out"); ifstream fin("ride.in"); string a, b; int sumA = 1; int sumB = 1; fin >> a >> b; for (int i = 0; i < a.length(); i++) { a[i] %= 64; sumA = (sumA * a[i]) % 47; } for (int i = 0; i < b.length(); i++) { b[i] %= 64; sumB = (sumB * b[i]) % 47; } if (sumA == sumB) { fout << "GO"<<endl; } else { fout << "STAY"<<endl; } return 0; }
아직은 초보여서 코드가 매우 더럽습니다..
'ALGORITHM > USACO' 카테고리의 다른 글
Solving the usaco transform problem in c++ (0) 2019.08.11 Milking Cows /c++ (0) 2019.08.11 Broken Necklace /c++ (0) 2019.08.11 Friday the Thirteenth /c++ (0) 2019.08.11 Task 'gift1': Greedy Gift Givers /c++ (0) 2019.08.11