結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-07-11 19:29:35 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,691 bytes |
| コンパイル時間 | 2,396 ms |
| コンパイル使用メモリ | 105,984 KB |
| 実行使用メモリ | 262,784 KB |
| 最終ジャッジ日時 | 2024-12-22 10:59:48 |
| 合計ジャッジ時間 | 13,190 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 RE * 30 |
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
class Program
{
static void Main()
{
new Magatro().Solve();
}
}
class Magatro
{
private int N;
private int[] X, Y;
bool[,] B = new bool[40002, 40002];
private int[] Lx, Ly;
private void Scan()
{
N = int.Parse(Console.ReadLine());
X = new int[N];
Y = new int[N];
for (int i = 0; i < N; i++)
{
var line = Console.ReadLine().Split(' ');
X[i] = int.Parse(line[0]) + 20000;
Y[i] = int.Parse(line[1]) + 20000;
}
}
private void CalcL()
{
var resultX = new List<int>();
var resultY = new List<int>();
for (int x = -20; x <= 20; x++)
{
for (int y = -20; y <= 20; y++)
{
if (Math.Sqrt(x * x + y * y) < 20)
{
resultX.Add(x);
resultY.Add(y);
}
}
}
Lx = resultX.ToArray();
Ly = resultY.ToArray();
}
private bool C(int n)
{
if (B[X[n], Y[n]]) return false;
for (int i = 0; i < Lx.Length; i++)
{
B[X[n] + Lx[i], Y[n] + Ly[i]] = true;
}
return true;
}
public void Solve()
{
Scan();
CalcL();
int ans = 0;
for (int i = 0; i < N; i++)
{
if (C(i))
{
ans++;
}
}
Console.WriteLine(ans);
}
}
mban