結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 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;
int queue[QUEUE_SIZE];

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

void init(void);
void enqueue(int x);
int 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(int x){
		queue[rear] = x;
		rear = next(rear);
}

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

0