結果

問題 No.112 ややこしい鶴亀算
ユーザー Yatsuku
提出日時 2015-11-17 00:33:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 343 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 15:43:47
合計ジャッジ時間 1,670 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 9 RE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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", &num);
      |         ~~~~~^~~~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%d", &animal[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void)
{
	int num;
	int animal[50] = {0};
	int bird = 0, turtle = 0;
	int i;

	scanf("%d", &num);

	for ( i = 1; i <= num; i++ ) {
		scanf("%d", &animal[i]);
	}

	for ( i = 1; i <= num; i++ ) {
		if ( animal[i] % 4 == 0 ) {
			turtle++;
		} else {
			bird++;
		}
	}

	printf("%d %d\n", turtle, bird);

	return 0;
}
0