結果
| 問題 | No.461 三角形はいくつ? |
| コンテスト | |
| ユーザー |
りあん
|
| 提出日時 | 2016-05-10 00:05:07 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,830 bytes |
| 記録 | |
| コンパイル時間 | 899 ms |
| コンパイル使用メモリ | 113,888 KB |
| 実行使用メモリ | 53,768 KB |
| 最終ジャッジ日時 | 2024-11-29 03:12:35 |
| 合計ジャッジ時間 | 188,370 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 WA * 9 TLE * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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(); } }
}
りあん