結果

問題 No.717 ファッションへのこだわり
ユーザー toto
提出日時 2025-03-28 17:54:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 621 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 28,032 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-28 17:54:31
合計ジャッジ時間 1,301 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
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("%d%d",&ue,&sita);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%s",strue);
      |         ~~~~~^~~~~~~~~~~~
main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         scanf("%s",strsita);
      |         ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	int ue,sita;
	scanf("%d%d",&ue,&sita);
	
	char strue[ue];
	scanf("%s",strue);
	int simpleue = 0;
	int soliue = 0;
	for(int i = 0;i < ue;i ++){
		if(strue[i] == 'A'){
			simpleue++;
		}else{
			soliue++;
		}
	}
	
	char strsita[sita];
	scanf("%s",strsita);
	int simplesita = 0;
	int solisita = 0;
	for(int i = 0;i < sita;i ++){
		if(strsita[i] == 'A'){
			simplesita++;
		}else{
			solisita++;
		}
	}
	
	int ans = 0; 
	if(solisita >= soliue){
		ans += soliue;
	}else{
		ans += solisita;
	}
	if(simplesita >= simpleue){
		ans += simpleue;
	}else{
		ans += simplesita;
	}
	printf("%d",ans);
}
0