結果
問題 | No.202 1円玉投げ |
ユーザー |
![]() |
提出日時 | 2017-07-11 19:31:00 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 1,650 ms / 5,000 ms |
コード長 | 1,691 bytes |
コンパイル時間 | 937 ms |
コンパイル使用メモリ | 105,984 KB |
実行使用メモリ | 494,964 KB |
最終ジャッジ日時 | 2024-12-22 11:00:31 |
合計ジャッジ時間 | 28,755 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
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[40050, 40050];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]) + 20020;Y[i] = int.Parse(line[1]) + 20020;}}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);}}