結果
問題 |
No.723 2つの数の和
|
ユーザー |
|
提出日時 | 2018-08-14 01:05:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 494 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 23,424 KB |
実行使用メモリ | 13,756 KB |
最終ジャッジ日時 | 2024-09-24 08:28:29 |
合計ジャッジ時間 | 6,046 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 2 -- * 20 |
コンパイルメッセージ
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]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#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) { if (a[i] > x) { continue; } for (int j = 0; j < array_len; ++j) { if ((a[i] + a[j]) == x) { count++; } } } printf("%d\n", count); }