結果

問題 No.723 2つの数の和
ユーザー Layla
提出日時 2018-08-14 01:00:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 453 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-09-24 08:28:18
合計ジャッジ時間 3,796 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d%lld", &array_len, &x);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

typedef long long int ll;

int main(void) {
    int array_len;
    ll x;
    scanf("%d%lld", &array_len, &x);
    int a[array_len];
    for (int i = 0; i < array_len; ++i) {
        scanf("%d", &a[i]);
    }

    int count = 0;

    for (int i = 0; i < array_len; ++i) {
        for (int j = 0; j < array_len; ++j) {
            if((a[i]+a[j]) == x){
                count++;
            }
        }
    }
    printf("%d\n",count);
}
0