結果

問題 No.112 ややこしい鶴亀算
ユーザー pulcherriman
提出日時 2016-11-09 02:32:20
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 205 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-25 05:23:21
合計ジャッジ時間 727 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |         scanf("%d",&n);
      |         ^~~~~~~~~~~~~~
main.c:6:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |                 scanf("%d",&a[i]);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(){
	int n,i,a[50],t=0,r=0;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
		t+=a[i];
	}
	t/=(n-1);
	for(i=0;i<n;i++){
		if(t-a[i]==2)r++;
	}
	printf("%d %d\n",r,n-r);
}
0