結果
| 問題 |
No.717 ファッションへのこだわり
|
| コンテスト | |
| ユーザー |
toto
|
| 提出日時 | 2025-04-01 10:02:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 578 bytes |
| コンパイル時間 | 559 ms |
| コンパイル使用メモリ | 28,160 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-01 10:02:51 |
| 合計ジャッジ時間 | 1,207 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%ld%ld",&val1,&val2);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%s",str1);
| ~~~~~^~~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%s",str2);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(){
long val1, val2;
scanf("%ld%ld",&val1,&val2);
char str1[val1];
scanf("%s",str1);
char str2[val2];
scanf("%s",str2);
long A1 = 0;
long B1 = 0;
for(long i = 0;i < val1;i ++){
if(str1[i] == 'A'){
A1++;
}else if(str1[i] == 'B'){
B1++;
}
}
long A2 = 0;
long B2 = 0;
for(long i = 0;i < val2;i ++){
if(str2[i] == 'A'){
A2++;
}else if(str2[i] == 'B'){
B2++;
}
}
long ans = 0;
if(A1 > A2){
ans += A2;
}else{
ans += A1;
}
if(B1 > B2){
ans += B2;
}else{
ans += B1;
}
printf("%ld",ans);
}
toto