結果

問題 No.383 レーティング
ユーザー Taro_ColdTaro_Cold
提出日時 2017-10-04 23:55:05
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 1,547 ms
コンパイル使用メモリ 28,300 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-10 12:52:09
合計ジャッジ時間 1,004 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 0 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

#define QUEUE_SIZE 100
int rear;
int front;
typedef int ELEM;
ELEM queue[QUEUE_SIZE];

#define next(a) (((a) + 1) % QUEUE_SIZE)

void init(void);
void enqueue(ELEM x);
ELEM dequeue(void);

int main(void){
		init();
		int x = 0;
		int y = 0;
		for(int i = 0;i < 2;i++){
				scanf("%d", &x);
				enqueue(x);
		}
		y = -dequeue() + dequeue();

		if(y == 0){
				printf("0\n");
		}else if(y > 0){
				printf("+%d\n", y);
		}else{
				printf("%d\n", y);
		}

		return 0;
}

void init(void){
		rear = front = 0;
}

void enqueue(ELEM x){
		queue[rear] = x;
		rear = next(rear);
}

ELEM dequeue(void){
		ELEM x = 0;
		x = queue[front];
		front = next(front);
	   	return x;
}	

0