結果

問題 No.112 ややこしい鶴亀算
ユーザー 👑 testestest
提出日時 2015-08-05 18:33:20
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 240 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-18 03:31:14
合計ジャッジ時間 910 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 | scanf("%d%d",&n,&s);m=n-1;x=s;
      | ^~~~~~~~~~~~~~~~~~~
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d",&s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
int n,m,a=1,x=0,y=0,s;
scanf("%d%d",&n,&s);m=n-1;x=s;
while(m--){
	scanf("%d",&s);
	if(s-x)y=s<x?-1:1;else a++;
}
y>0&&(a=n-a);if(y)printf("%d %d",a,n-a);
else{a=x-n*2+2?0:n;printf("%d %d",a,n-a);}
return 0;
}
0