結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
sper_air_reader
|
| 提出日時 | 2017-10-26 07:16:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.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 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 7 |
コンパイルメッセージ
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);
}
sper_air_reader