Hi! I need help with this USACO problem : http://www.usaco.org/index.php?page=viewproblem2&cpid=891
My solution:
#include <fstream>
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main()
{
ifstream fin ("shell.in");
ofstream fout ("shell.out");
int N , i;
int A[N];
int B[N];
int G[N];
fin >> N;
for(i = 0 ; i < N ; i++)
{
fin >> A[i] >> B[i] >> G[i];
}
int maximum_score = 0;
for(i = 0 ; i < N ; i++)
{
if(A[i] == G[i])
{
maximum_score++;
}
else if(B[i] == G[i])
{
maximum_score++;
}
}
fout << maximum_score;
}
thanks in advance