結果
問題 | No.717 ファッションへのこだわり |
ユーザー |
|
提出日時 | 2018-08-01 08:31:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 413 bytes |
コンパイル時間 | 764 ms |
コンパイル使用メモリ | 22,528 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-19 16:44:08 |
合計ジャッジ時間 | 702 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d %d",&N,&M); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%s",S); | ~~~~~^~~~~~~~ main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%s",S); | ~~~~~^~~~~~~~
ソースコード
#include <stdio.h> int min(int A, int B){return (A<B)?A:B;} int main(){ int N,M; char S[10001]; int cntSA = 0, cntSB = 0; int cntTA = 0, cntTB = 0; scanf("%d %d",&N,&M); scanf("%s",S); for(int i = 0; i < N; i++){ if(S[i] == 'A') cntSA++; else cntSB++; } scanf("%s",S); for(int i = 0; i < M; i++){ if(S[i] == 'A') cntTA++; else cntTB++; } printf("%d\n",min(cntSA,cntTA)+min(cntSB,cntTB)); }