結果
| 問題 | No.2260 Adic Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-29 21:56:40 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 256 ms / 2,000 ms |
| コード長 | 1,026 bytes |
| 記録 | |
| コンパイル時間 | 581 ms |
| コンパイル使用メモリ | 114,180 KB |
| 実行使用メモリ | 45,568 KB |
| 最終ジャッジ日時 | 2026-03-28 01:03:57 |
| 合計ジャッジ時間 | 5,108 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
static int NN => int.Parse(ReadLine());
static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
public static void Main()
{
Solve();
}
static void Solve()
{
var c = NList;
var (n, p) = (c[0], c[1]);
var a = NList;
var max = a.Max();
var div = (long)p;
var ans = 0L;
while (true)
{
if (div >= max) break;
var dic = new Dictionary<long, int>();
foreach (var ai in a)
{
var am = ai % div;
if (dic.ContainsKey(am))
{
ans += dic[am];
++dic[am];
}
else dic[am] = 1;
}
div *= p;
}
WriteLine(ans);
}
}