NYOJ558 一二三

原题链接

这题很简单,但是做得我想哭%>_<%,都是因为没看懂题意,错了三次,没想到小孩还有写正确的情况。题意啊题意...

 
#include <cstdio>
#include <cstring>
char *a[] = {"one", "two", "three"}, str[6];

int cmp(char s[]){
	int count = 0, len = strlen(str);
	for(int i = 0; i != len; ++i)
		if(s[i] != str[i]) ++count;
	return count;
}

int main(){
	int t, i, x;
	scanf("%d", &t);
	while(t-- && scanf("%s", str))
		for(i = 0; i != 3; ++i)
			if((x = cmp(a[i])) == 1 || x == 0){
				printf("%d\n", i + 1);
				break;
			}	
	return 0;
}        


posted on 2014-02-28 22:45  长木Qiu  阅读(111)  评论(0编辑  收藏  举报