結果

問題 No.3456 Common Difference is D
コンテスト
ユーザー zame takoyaki
提出日時 2026-03-31 13:19:14
言語 C
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 396 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 102 ms
コンパイル使用メモリ 37,248 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2026-03-31 13:20:46
合計ジャッジ時間 18,745 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 TLE * 6 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main(void){
	int N,D;
	int count=0;
	scanf("%d", &N);
	scanf("%d", &D);
	
	int A[N];
	
	for(int l = 0; l <N ; l++)
	{
		scanf("%d", &A[l]);
	}
	
	for(int i = 0; i < N; i++)
	{
	 for(int j = i+1; j < N; j++)
	 {
	  if(A[j]-A[i] == D)
	  {
	   for(int k = j+1;k < N ;k++)
	   {
	   	if(A[k] - A[j] == D)
	   	   count++;
	   }
	  }	
	 }
	}
	printf("%d", count);
	return 0;
}
0