Codechef Tanu and Head-bob

Problem Description

Tanu has got interested in signs and gestures that we use for communication. One such gesture is the head-bob.
When we want to signal "Yes" to someone, we move the head up-and-down. For "No", the head is moved left-and-right, rotating about the vertical axis.
There is a peculiar way of gesturing "Yes", commonly seen in India, by moving head sideways (rotating about the forward-back axis). This is called the Indian head-bob.
Tanu observed many people on the railways station, and made a list of gestures that they made. Usual "Yes" gesture is recorded as "Y", no as "N" and Indian "Yes" gesture as "I". (Assume no foreigner uses the Indian "Yes" gesture and vice-versa). Identify which of them were Indians, which were not Indian, and which one you cannot be sure about.

Input

First line contains T, number of people observed by Tanu.
Each person is described in two lines. First line of the description contains a single integer N, the number of gestures recorded for this person. Next line contains a string of N characters, each character can be "Y", "N" or "I".

Output

For each person, print "INDIAN" if he/she is from India, "NOT INDIAN" if not from India, and "NOT SURE" if the information is insufficient to make a decision.

Constraints

For 30 points: 1 ≤ T,N ≤ 100
For 70 points: 1 ≤ T,N ≤ 1000

Example

Input:

3
5
NNNYY
6
NNINNI
4
NNNN

Output:

NOT INDIAN
INDIAN
NOT SURE

题解

好像就是几行if。
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int T,a,b,c,n;
char ch[1002];
int main()
{
	scanf("%d",&T);
	while(T--)
	   {scanf("%d",&n);
	    scanf("%s",ch);
	    a=b=c=0;
	    int i;
	    for(i=0;i<n;i++)
	       {if(ch[i]=='I') a++;
		    else if(ch[i]=='Y') b++;
		    else c++;
		   }
		if(a>0&&b==0) {printf("INDIAN\n"); continue;}
		else if(a>0&&b>0) {printf("NOT INDIAN\n"); continue;}
		if(a==0&&b>0) {printf("NOT INDIAN\n"); continue;}
		else {printf("NOT SURE\n"); continue;}
	   }
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值