結果
問題 | No.559 swapAB列 |
ユーザー | sper_air_reader |
提出日時 | 2017-10-26 07:16:40 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 198 bytes |
コンパイル時間 | 1,560 ms |
コンパイル使用メモリ | 165,008 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 19:46:14 |
合計ジャッジ時間 | 1,970 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:6:14: warning: 's' is used uninitialized [-Wuninitialized] 6 | scanf(s); | ~~~~~^~~ In file included from /usr/include/features.h:486, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/os_defines.h:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/c++config.h:655, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/cassert:43, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:33, from main.cpp:1: /usr/include/stdio.h:437:12: note: by argument 1 of type 'const char*' to 'int scanf(const char*, ...)' declared here 437 | extern int __REDIRECT (scanf, (const char *__restrict __format, ...), | ^~~~~~~~~~ main.cpp:5:14: note: 's' declared here 5 | char s[99]; | ^ main.cpp:12:15: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 12 | printf("%d",ans); | ~~~~~~^~~~~~~~~~ main.cpp:4:17: note: 'ans' was declared here 4 | int b,n,ans; | ^~~ main.cpp:9:33: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized] 9 | if(s[i]=='A')ans+=b; | ~~~^~~ main.cpp:4:13: note: 'b' was declared here 4 | int b,n,ans; | ^
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int b,n,ans; char s[99]; scanf(s); n=strlen(s); for(int i=0;i<n;i++){ if(s[i]=='A')ans+=b; if(s[i]=='B')b++; } printf("%d",ans); }