結果

問題 No.112 ややこしい鶴亀算
コンテスト
ユーザー testestest
提出日時 2015-08-05 18:33:20
言語 C90
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 240 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 160 ms
コンパイル使用メモリ 29,608 KB
最終ジャッジ日時 2026-02-23 18:57:47
ジャッジサーバーID
(参考情報)
judge4 / 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 #
raw source code

#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