結果

問題 No.3100 始業式
ユーザー aguroshouaguroshou
提出日時 2023-03-31 22:29:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 378 bytes
コンパイル時間 1,536 ms
コンパイル使用メモリ 165,740 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-09-23 01:17:39
合計ジャッジ時間 1,915 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
                 from main.cpp:1:
In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]',
    inlined from 'int main()' at main.cpp:25:10:
/home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'answer' may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: In function 'int main()':
main.cpp:10:21: note: 'answer' was declared here
   10 |         ll t, n, f, answer;
      |                     ^~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
	ll t, n, f, answer;
	cin >> t;
	for (ll i = 0; i < t; i++)
	{
		cin >> n;
		answer = 0;
		for (ll k = 0; k < n; k++)
		{
			cin >> f;
			if (f==1)
			{
				answer++;
			}
		}
	}
	cout << answer << endl;
	return 0;
}

0