結果

問題 No.586 ダブルブッキング
ユーザー ECHO_1221
提出日時 2017-12-05 03:01:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 327 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 22,912 KB
実行使用メモリ 7,808 KB
最終ジャッジ日時 2024-11-28 07:23:34
合計ジャッジ時間 2,119 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
   10 |         scanf("%d\n", x);
      |                ~^     ~
      |                 |     |
      |                 int*  int
main.cpp:11:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
   11 |         scanf("%d\n", y);
      |                ~^     ~
      |                 |     |
      |                 int*  int
main.cpp:12:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
   12 |         scanf("%d\n", z);
      |                ~^     ~
      |                 |     |
      |                 int*  int
main.cpp:15:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘int’ [-Wformat=]
   15 |                 scanf("%d\n", room[i]);
      |                        ~^     ~~~~~~~
      |                         |           |
      |                         int*        int
main.cpp:10:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d\n", x);
      |         ~~~~~^~~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d\n", y);
      |         ~~~~~^~~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d\n", z);
      |         ~~~~~^~~~~~~~~~~
main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |                 scanf("%d\n", room[i]);
      |                 ~~~

ソースコード

diff #

#include <stdio.h>

int main()
{
	int x,y,z;
	int room[100];
	int i = 0;
	int sum = 0;
	
	scanf("%d\n", x);
	scanf("%d\n", y);
	scanf("%d\n", z);
	
	while(i < z){
		scanf("%d\n", room[i]);
		i++;
	}
	i = 0;
	while(i < z){
		if(room[i] == room[i + 1]){
			sum += 1;
		}
		i++;
	}
	printf("%d\n", sum * (x + y));
	
	return (0);
}
0