USACO 1.1.1 – Your Ride Is Here

int main_ride() {
	char c;
	int p1 = 1, p2 = 1;
	while ( fin.get(c)  && c != '\n')
		p1 *= c - 'A' + 1;
	while ( fin.get(c) && c != '\n' )
		p2 *= c - 'A' + 1;

	fout << ((p1 % 47 == p2 % 47) ? "GO" : "STAY") << endl;

	return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: