結果
問題 |
No.33 アメーバがたくさん
|
ユーザー |
![]() |
提出日時 | 2014-11-02 05:13:28 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,263 bytes |
コンパイル時間 | 809 ms |
コンパイル使用メモリ | 111,072 KB |
実行使用メモリ | 26,256 KB |
最終ジャッジ日時 | 2024-09-24 09:57:17 |
合計ジャッジ時間 | 1,624 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 7 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; class Program { public static void Main(string[] args) { var firstline = Console.ReadLine().Split(' '); var n = long.Parse(firstline[0]); var d = long.Parse(firstline[1]); var t = long.Parse(firstline[2]); var secondline = Console.ReadLine().Split(' '); var points = new long[n]; var counted = new bool[n]; for (long i = 0; i < n; i++) { points[i] = long.Parse(secondline[i]); } long count = 0; for (long i = 0; i < n; i++) { if (counted[i]) { continue; } counted[i] = true; count += 2*t + 1; for (long k = i + 1; k < n; k++) { if ((points[k] - points[i])%d != 0) { continue; } var distance = Math.Abs(points[k] - points[i]) / d; if (distance > 2 * t) { continue; } counted[k] = true; count += distance + Math.Max(0, distance - t); } } Console.WriteLine(count); } }