結果
問題 |
No.383 レーティング
|
ユーザー |
![]() |
提出日時 | 2017-10-05 00:14:00 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 696 bytes |
コンパイル時間 | 1,103 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 18:54:56 |
合計ジャッジ時間 | 1,733 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 13 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:20:33: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d", &x); | ^~~~~~~~~~~~~~~
ソースコード
#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 if(y < 0){ 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; }