Problem Link : http://codeforces.com/problemset/problem/231/A
Solve:
#include<stdio.h>
int main()
{
int n,f1,f2,f3,Loop1,Count,AnsCounter=0,Loop2;
scanf("%d",&n);
for(Loop1=1;Loop1<=n;Loop1++)
{
Count=0;
scanf("%d%d%d",&f1,&f2,&f3);
if(f1==1)
Count++;
if(f2==1)
Count++;
if(f3==1)
Count++;
if(Count>1)
AnsCounter++;
}
printf("%d\n",AnsCounter);
return 0;
}
Solve:
#include<stdio.h>
int main()
{
int n,f1,f2,f3,Loop1,Count,AnsCounter=0,Loop2;
scanf("%d",&n);
for(Loop1=1;Loop1<=n;Loop1++)
{
Count=0;
scanf("%d%d%d",&f1,&f2,&f3);
if(f1==1)
Count++;
if(f2==1)
Count++;
if(f3==1)
Count++;
if(Count>1)
AnsCounter++;
}
printf("%d\n",AnsCounter);
return 0;
}
No comments:
Post a Comment