結果

問題 No.461 三角形はいくつ?
ユーザー りあんりあん
提出日時 2016-05-10 00:05:07
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,830 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 116,580 KB
実行使用メモリ 33,300 KB
最終ジャッジ日時 2024-05-06 18:23:12
合計ジャッジ時間 8,043 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
27,468 KB
testcase_01 AC 30 ms
25,520 KB
testcase_02 AC 29 ms
25,340 KB
testcase_03 AC 25 ms
23,800 KB
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using Point = System.Tuple<double, double>;

class Program
{
    static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        var sc = new Scan();
        int n = sc.Int;
        var lines = new List<int[]>[3];
        for (int i = 0; i < 3; i++)
        {
            lines[i] = new List<int[]>();
            lines[i].Add(new int[]{0, 1});
        }
        for (int i = 0; i < n; i++)
        {
            var a = sc.IntArr;
            int g = gcd(a[1], a[2]);
            lines[a[0]].Add(new int[]{a[2] / g, (a[1] + a[2]) / g});
        }
        int ans = 0;
        foreach (var a in lines[0])
        {
            foreach (var b in lines[1])
            {
                if (!ok(a, b)) continue;
                
                int s = a[0] * b[1] + a[1] * b[0], t = a[1] * b[1];
                foreach (var c in lines[2])
                    if (ok(a, c) && ok(b, c) && s * c[1] != t * (c[1] - c[0]))
                        ++ans;
            }
        }
        sw.WriteLine(ans);
        sw.Flush();
    }
    static bool ok(int[] a, int[] b)
    {
        return a[0] * b[1] + a[1] * b[0] <= a[1] * b[1];
    }
    
    static int gcd(int a, int b)
    {
        while (b > 0) { var t = a % b; a = b; b = t; }
        return a;
    }
}
class Scan
{
    public int Int { get { return int.Parse(Str); } }
    public long Long { get { return long.Parse(Str); } }
    public string Str { get { return Console.ReadLine().Trim(); } }
    public int[] IntArr { get { return StrArr.Select(int.Parse).ToArray(); } }
    public long[] LongArr { get { return StrArr.Select(long.Parse).ToArray(); } }
    public string[] StrArr { get { return Str.Split(); } }
}
0