結果
| 問題 | No.369 足し間違い |
| コンテスト | |
| ユーザー |
fal_rnd
|
| 提出日時 | 2016-12-24 23:43:03 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 225 bytes |
| 記録 | |
| コンパイル時間 | 410 ms |
| コンパイル使用メモリ | 68,592 KB |
| 実行使用メモリ | 7,968 KB |
| 最終ジャッジ日時 | 2026-05-25 11:13:20 |
| 合計ジャッジ時間 | 1,063 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 5 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:5:16: warning: ignoring return value of 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]', declared with attribute 'nodiscard' [-Wunused-result]
5 | cin.tie();
| ~~~~~~~^~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:48,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/basic_ios.h:310:7: note: declared here
310 | tie() const
| ^~~
main.cpp:11:20: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized]
11 | sum+=b;
| ~~~^~~
main.cpp:7:17: note: 'sum' was declared here
7 | int a,b,sum,y;
| ^~~
ソースコード
#include <iostream>
using namespace std;
const char en='\n';
int main(){
cin.tie();
ios::sync_with_stdio(false);
int a,b,sum,y;
cin>>a;
for(int i=0;i<a;++i){
cin>>b;
sum+=b;
}
cin>>y;
cout<<sum-y<<en;
return 0;
}
fal_rnd