結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
MoritaYasuaki
|
| 提出日時 | 2016-05-09 02:07:22 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 423 bytes |
| 記録 | |
| コンパイル時間 | 257 ms |
| コンパイル使用メモリ | 39,424 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-21 01:06:15 |
| 合計ジャッジ時間 | 1,614 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 4 |
コンパイルメッセージ
main.cpp:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
18 | main(){
| ^~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#define int ptrdiff_t
#define div lldiv
#define div_t lldiv_t
#define abs(a) ((a)<0?-(a):(a))
int A,B,S;
int calc(void) {
if (S == 1 || abs(A-S) <= abs(B-S))
return abs(A-S) + abs(S-0);
return abs(B-S) + abs(S-1) + abs(A-1) + abs(1-0);
}
main(){
int ans = 0;
scanf("%td%td%td\n", &A,&B,&S);
printf("%td\n", calc());
return 0;
}
MoritaYasuaki