URI Online Judge | 1250 KiloMan solve in C
Posted by Unknown on Friday, September 04, 2015 with No comments
#include<stdio.h>
#include<string.h>
int
main()
{
int
hits[1000],i,testCase,numberOfHits,count=0;
char
position[10000];
scanf
(
"%d"
,&testCase);
while
(testCase--)
{
count=0;
scanf
(
"%d"
,&numberOfHits);
for
(i=0;i<numberOfHits;i++)
{
scanf
(
"%d"
,&hits[i]);
}
scanf
(
"%s"
,position);
for
(i=0;i<numberOfHits;i++)
{
if
(hits[i]>0&&hits[i]<=2&&position[i]==
'S'
)
{
count++;
}
else
if
(hits[i]>2&&position[i]==
'J'
)
{
count++;
}
}
printf
(
"%d\n"
,count);
}
return
0;
}
0 comments:
Post a Comment