-
Notifications
You must be signed in to change notification settings - Fork 0
/
BPL_Mubarak.c
48 lines (44 loc) · 1.03 KB
/
BPL_Mubarak.c
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<stdio.h>
#include<string.h>
int main()
{
int i,n,j,count;
char s[100];
scanf("%d",&n);
getchar();
for(j=0;j<n;j++)
{
gets(s);
count=0;
for(i=0;i<strlen(s);i++)
{
if(s[i]>='0' && s[i]<='6')
count++;
if(s[i]=='O')
count++;
}
if(count==1)
printf("1 BALL\n");
if(count<6)
printf("%d BALLS\n",count);
if(count==6)
printf("1 OVER\n");
if(count>6)
{
if(count%6==0)
printf("%d OVERS\n",count/6);
else
{
if(count/6==1)
{
if(count%6==1)
printf("%d OVER %d BALL\n",count/6,count%6);
else
printf("%d OVER %d BALLS\n",count/6,count%6);
}
else
printf("%d OVERS %d BALLS\n",count/6,count%6);
}
}
}
}