2403. Voting
2011-05-20 08:17 Min·zc 阅读(151) 评论(0) 编辑 收藏 举报
1 #include <iostream>
2 #include <string.h>
3 #include <math.h>
4 using namespace std;
5 int a,y,n,p;
6 char v[100];
7 int main()
8 {
9 while(true)
10 {
11 cin>>v;
12 if(v[0]=='#')
13 break;
14 a=y=n=p=0;
15 int len=strlen(v);
16 for(int i=0;i<len;i++)
17 switch(v[i])
18 {
19 case 'Y':y++;break;
20 case 'N':n++;break;
21 case 'A':a++;break;
22 }
23 if(a>=(len-a))
24 cout<<"need quorum"<<endl;
25 else if(y>n)
26 cout<<"yes"<<endl;
27 else if(y==n)
28 cout<<"tie"<<endl;
29 else
30 cout<<"no"<<endl;
31 }
32 }
2 #include <string.h>
3 #include <math.h>
4 using namespace std;
5 int a,y,n,p;
6 char v[100];
7 int main()
8 {
9 while(true)
10 {
11 cin>>v;
12 if(v[0]=='#')
13 break;
14 a=y=n=p=0;
15 int len=strlen(v);
16 for(int i=0;i<len;i++)
17 switch(v[i])
18 {
19 case 'Y':y++;break;
20 case 'N':n++;break;
21 case 'A':a++;break;
22 }
23 if(a>=(len-a))
24 cout<<"need quorum"<<endl;
25 else if(y>n)
26 cout<<"yes"<<endl;
27 else if(y==n)
28 cout<<"tie"<<endl;
29 else
30 cout<<"no"<<endl;
31 }
32 }