結果
| 問題 | No.559 swapAB列 |
| コンテスト | |
| ユーザー |
sper_air_reader
|
| 提出日時 | 2017-10-26 07:16:40 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 198 bytes |
| 記録 | |
| コンパイル時間 | 1,159 ms |
| コンパイル使用メモリ | 179,284 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-15 23:37:31 |
| 合計ジャッジ時間 | 1,804 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 1 WA * 6 |
コンパイルメッセージ
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:523,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/os_defines.h:39,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/c++config.h:727,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/cassert:45,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/x86_64-pc-linux-gnu/bits/stdc++.h:33,
from main.cpp:1:
/usr/include/stdio.h:445:12: note: by argument 1 of type 'const char*' to 'int scanf(const char*, ...)' declared here
445 | extern int __REDIRECT (scanf, (const char *__restrict __format, ...),
| ^~~~~~~~~~
main.cpp:5:14: note: 's' declared here
5 | char s[99];
| ^
main.cpp:10:31: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
10 | if(s[i]=='B')b++;
| ~^~
main.cpp:4:13: note: 'b' was declared here
4 | int b,n,ans;
| ^
main.cpp:9:33: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
9 | if(s[i]=='A')ans+=b;
| ~~~^~~
main.cpp:4:17: note: 'ans' 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