Submission #5911660


Source Code Expand

using System.Collections.Generic;
using System.Text;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        int N = ReadLineParseInt();
        KeyValuePair<int, int>[] pos = new KeyValuePair<int, int>[N];
        for(int i = 0; i < N; i++)
        {
            int[] xy = ReadLineParseIntArray();
            pos[i] = new KeyValuePair<int, int>(xy[0], xy[1]);
        }
        int ans = 0;
        for(int i = 0; i < N - 2; i++)
            for(int j = i + 1; j < N - 1; j++)
                for(int k = j + 1; k < N; k++)
                {
                    int x1 = pos[j].Key - pos[i].Key;
                    int y1 = pos[j].Value - pos[i].Value;
                    int x2 = pos[k].Key - pos[i].Key;
                    int y2 = pos[k].Value - pos[i].Value;
                    long v = Abs(x1 * y2 - y1 * x2);
                    if (v != 0 && v % 2 == 0)
                        ans++;
                }
        WriteLine(ans);
    }
    static int ReadLineParseInt() => int.Parse(ReadLine());
    static int[] ReadLineParseIntArray() => ReadLine().Split(' ').Select(int.Parse).ToArray();
}

Submission Info

Submission Time
Task B - 格子点と整数
User oziya
Language C# (Mono 4.6.2.0)
Score 0
Code Size 1202 Byte
Status CE

Compile Error

./Main.cs(33,67): error CS1061: Type `string[]' does not contain a definition for `Select' and no extension method `Select' of type `string[]' could be found. Are you missing `System.Linq' using directive?
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)