2017年4月5日 星期三

UVa 12289 One-Two-Three - 參考答案

Difficulty: Eazy
Ref: UVa Online Judge - UVa 12289 One-Two-Three
/*******************************************************/
/* UVa 12289 - One-Two-Three                           */
/* Author: awei0905  [at]  awei0905.blogspot.tw        */
/* Version: 2017/04/04                                 */
/*******************************************************/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

int main() {
 int n, one;
 char input[6];
 scanf("%d", &n);
 while (n-- > 0 && scanf("%s", &input) != EOF) {
  if (input[3] != '\0') {
   printf("3\n");
   continue;
  }
  one = 0;
  if (input[0] == 'o') one++;
  if (input[1] == 'n') one++;
  if (input[2] == 'e') one++;
  if (one >= 2) printf("1\n");
  else  printf("2\n");
 }
}
Debug: I/O, uDebug
10
owe
too
theee
tne
owo
thfee
ono
twe
one
two
1
2
3
1
2
3
1
2
1
2

沒有留言:

張貼留言