UVa 13012 - Identifying tea

Contents

  1. 1. Problem
  2. 2. Solution
  3. 3. Code

Problem

題目網址

參加者要盲測茶的種類,給予正確答案和參加者的答案,輸出答案正確的人數。

Solution

每次檢查一不一樣,並且計數即可。

Code

UVa 13012UVa 13012 - Identifying tea
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

#include<cstdio>

int main()
{
char type;
char c;

while ((type = getchar()) != EOF)
{
getchar();
int count = 0;
for (int i = 0; i < 5; i++)
{
if (getchar() == type)
count++;
getchar();
}

printf("%d\n", count);
}

return 0;
}