結果

問題 No.112 ややこしい鶴亀算
ユーザー tska
提出日時 2015-04-27 17:50:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 1,386 ms
コンパイル使用メモリ 158,004 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-05 04:54:08
合計ジャッジ時間 2,184 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 WA * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
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);
      |         ~~~~~^~~~~~~~~
main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%d",&a[i]);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define PI 3.14159265359

int main() {
	
	int n;
	int a[50];
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int tu=0,ka=0;
	for(int i=0;i<n;i++){
		if(a[i]==2){ka++;}else{tu++;}
	}
	cout<<tu<<" "<<ka<<endl;
	
	return 0;
}
0