結果

問題 No.2374 ASKT Subsequences
ユーザー Himatsubushin
提出日時 2023-07-11 15:43:19
言語 C90
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 799 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 22,272 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-09-13 05:56:57
合計ジャッジ時間 5,068 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 TLE * 1 -- * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d", &x[i]);
      |         ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define N 2000

int main(void) {
    int a, b, c, d, k1, k2, k3, i, n, count, x[N];

    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &x[i]);

    count = 0;
    for (a = 0; a < n - 3; a++) {
        for (b = a + 1; b < n - 2; b++) {
            k1 = x[b] - x[a] - 10;
            if (k1 <= 0)
                continue;
            for (c = b + 1; c < n - 1; c++) {
                k2 = x[b] - x[c];
                if (k1 != k2)
                    continue;
                for (d = c + 1; d < n; d++) {
                    k3 = x[d] - x[c] - 1;
                    if (k1 == k3)
                        count++;
                }
            }
        }
    }

    printf("%d\n", count);

    return EXIT_SUCCESS;
}
0