UVa – 10530 – Guessing Game

#include <stdio.h>
#include <string.h>
int main() {
	int n;
	char line[20], a[11];
	while (scanf("%d\n", &n) == 1 && n && gets(line)) {
		if (line[4] == 'l')			memset(a, 1, n + 1);
		else if (line[4] == 'h')	memset(a + n, 1, 10 - n + 1);
		else {
			puts(a[n] ? "Stan is dishonest" : "Stan may be honest");
			memset(a, 0, 11);
		}
	}
	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: