結果

問題 No.197 手品
ユーザー fiord
提出日時 2015-05-23 09:09:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 659 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 23,552 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 09:42:16
合計ジャッジ時間 1,402 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32 WA * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:55: warning: format ‘%c’ expects argument of type ‘int’, but argument 3 has type ‘char*’ [-Wformat=]
   20 |                         char be2[4];    sprintf(be2,"%c%c%c",&before[0],&before[2],&before[1]);
      |                                                      ~^      ~~~~~~~~~~
      |                                                       |      |
      |                                                       int    char*
      |                                                      %s
main.cpp:20:57: warning: format ‘%c’ expects argument of type ‘int’, but argument 4 has type ‘char*’ [-Wformat=]
   20 |                         char be2[4];    sprintf(be2,"%c%c%c",&before[0],&before[2],&before[1]);
      |                                                        ~^               ~~~~~~~~~~
      |                                                         |               |
      |                                                         int             char*
      |                                                        %s
main.cpp:20:59: warning: format ‘%c’ expects argument of type ‘int’, but argument 5 has type ‘char*’ [-Wformat=]
   20 |                         char be2[4];    sprintf(be2,"%c%c%c",&before[0],&before[2],&before[1]);
      |                                                          ~^                        ~~~~~~~~~~
      |                                                           |                        |
      |                                                           int                      char*
      |                                                          %s
main.cpp:21:55: warning: format ‘%c’ expects argument of type ‘int’, but argument 3 has type ‘char*’ [-Wformat=]
   21 |                         char be3[4];    sprintf(be3,"%c%c%c",&before[1],&before[0],&before[2]);
      |                                                      ~^      

ソースコード

diff #

#include <cstdio>
using namespace std;
int main(){
	char before[4],after[4];
	scanf("%s",before);
	int n;	scanf("%d",&n);
	scanf(" %s",after);
	short bo=0,ao=0;
	for(int i=0;i<3;i++){
		if(before[i]=='o')	bo++;
		if(after[i]=='o')	ao++;
	}
	if(bo!=ao)	printf("SUCCESS\n");
	else{
		if(n==0){
			if(before==after)	printf("SUCCESS\n");
			else 	printf("FAILURE\n");
		}
		else if(n==1){
			char be2[4];	sprintf(be2,"%c%c%c",&before[0],&before[2],&before[1]);
			char be3[4];	sprintf(be3,"%c%c%c",&before[1],&before[0],&before[2]);
			if(be2==after||be3==after)	printf("FAILURE\n");
			else 	printf("SUCCESS\n");
		}
		else 	printf("FAILURE\n");
	}
	return 0;
}
0