結果

問題 No.2260 Adic Sum
ユーザー publfl2publfl2
提出日時 2023-04-07 21:26:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 902 ms / 2,000 ms
コード長 353 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 54,528 KB
実行使用メモリ 8,960 KB
最終ジャッジ日時 2024-04-15 23:39:15
合計ジャッジ時間 6,671 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 AC 23 ms
5,760 KB
testcase_15 AC 32 ms
6,656 KB
testcase_16 AC 19 ms
5,504 KB
testcase_17 AC 36 ms
6,912 KB
testcase_18 AC 509 ms
8,576 KB
testcase_19 AC 552 ms
8,704 KB
testcase_20 AC 362 ms
8,576 KB
testcase_21 AC 364 ms
8,704 KB
testcase_22 AC 307 ms
8,448 KB
testcase_23 AC 199 ms
8,576 KB
testcase_24 AC 521 ms
8,832 KB
testcase_25 AC 60 ms
8,448 KB
testcase_26 AC 58 ms
8,448 KB
testcase_27 AC 61 ms
8,576 KB
testcase_28 AC 59 ms
8,576 KB
testcase_29 AC 58 ms
8,320 KB
testcase_30 AC 66 ms
6,912 KB
testcase_31 AC 185 ms
7,040 KB
testcase_32 AC 187 ms
7,168 KB
testcase_33 AC 64 ms
8,960 KB
testcase_34 AC 164 ms
8,832 KB
testcase_35 AC 902 ms
8,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <map>

std::map<int,int> M;
int x[100010];
int main()
{
	int a;
	long long int b;
	scanf("%d%lld",&a,&b);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	
	long long int p = b, ans = 0;
	while(p<=1000000000)
	{
		M.clear();
		for(int i=1;i<=a;i++)
		{
			M[x[i]%p]++;
			ans += (M[x[i]%p]-1);
		}
		p*=b;
	}
	printf("%lld",ans);
}
0