結果

問題 No.717 ファッションへのこだわり
ユーザー toto
提出日時 2025-04-01 09:53:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 29,056 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-01 09:53:26
合計ジャッジ時間 1,408 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:33:22: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long int*’ [-Wformat=]
   33 |         printf("A1:%ld A2:%ld B1:%ld B2:%ld\n",&A1,&A2,&B1,&B2);
      |                    ~~^                         ~~~
      |                      |                         |
      |                      long int                  long int*
      |                    %ln
main.cpp:33:29: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘long int*’ [-Wformat=]
   33 |         printf("A1:%ld A2:%ld B1:%ld B2:%ld\n",&A1,&A2,&B1,&B2);
      |                           ~~^                      ~~~
      |                             |                      |
      |                             long int               long int*
      |                           %ln
main.cpp:33:36: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘long int*’ [-Wformat=]
   33 |         printf("A1:%ld A2:%ld B1:%ld B2:%ld\n",&A1,&A2,&B1,&B2);
      |                                  ~~^                   ~~~
      |                                    |                   |
      |                                    long int            long int*
      |                                  %ln
main.cpp:33:43: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 has type ‘long int*’ [-Wformat=]
   33 |         printf("A1:%ld A2:%ld B1:%ld B2:%ld\n",&A1,&A2,&B1,&B2);
      |                                         ~~^                ~~~
      |                                           |                |
      |                                           long int         long int*
      |                                         %ln
main.cpp:41:23: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long int*’ [-Wformat=]
   41 |         printf("ans:%ld

ソースコード

diff #

#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{
			B1++;
		}
	}
	
	
	long A2 = 0;
	long B2 = 0;
	for(long i = 0;i < val2;i ++){
		if(str2[i] == 'A'){
			A2++;
		}else{
			B2++;
		}
	}
	printf("A1:%ld A2:%ld B1:%ld B2:%ld\n",&A1,&A2,&B1,&B2);
	long ans = 0;
	if(A1 > A2){
		ans += A2;
	}else{
		ans += A1;
	}
	
	printf("ans:%ld\n",&ans);
	
	if(B1 > B2){
		ans += B2;
	}else{
		ans += B1;
	}
	
	printf("ans:%ld\n",&ans);
	
	printf("%ld",ans);
}
0