C#C
C#16mo ago
17 replies
manuka

✅ code works fine on my pc but give runtime error on codeforces

Problem
https://codeforces.com/contest/231/problem/A

My Code
using System;

namespace CodeForces
{
    internal class Solution
    {
        public static void solve()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int[] a = new int[3];
            
            for(int i=0;i<n;i++)
            {
                int x = Convert.ToInt32(Console.ReadLine());
                int y = Convert.ToInt32(Console.ReadLine());
                int z = Convert.ToInt32(Console.ReadLine());
                a[i] = x+y+z;
            }
            
            int ans=0;
            for(int i=0;i<n;i++)
            {
                if(a[i]>=2)
                {
                    ans++;
                }
            }
            Console.WriteLine(ans);
        }
        
        public static void Main(string[] args)
        {
            solve();
        }
    }
}
Screenshot_2024-10-27_233917.png
Was this page helpful?