* 뭐 장난 같은 문제..--; 첫 문제라 그런거겠죠? * STL 쓰니까 정말 편하네요. 앞으로 자주 애용할듯.. {{{~cpp #include #include #include #include using namespace std; bool IsSameCode(const string& comet, const string& group); int AlphabetToNumber(char ch); int main() { string comet, group; ifstream fin("ride.in"); ofstream fout("ride.out"); fin >> comet; fin >> group; if(IsSameCode(comet, group)) fout << "GO\n"; else fout << "STAY\n"; fout.close(); fin.close(); return 0; } bool IsSameCode(const string& comet, const string& group) { long a = 1; long b = 1; basic_string::const_iterator i; for(i = comet.begin() ; i != comet.end() ; ++i) a *= AlphabetToNumber(*i); for(i = group.begin() ; i != group.end() ; ++i) b *= AlphabetToNumber(*i); return (a%47) == (b%47); } int AlphabetToNumber(char ch) { return ch - 64; } }}}