結果

問題 No.208 王将
ユーザー zaichuzaichu
提出日時 2016-02-02 14:48:04
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 1,854 ms
コンパイル使用メモリ 159,384 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2023-10-21 18:42:51
合計ジャッジ時間 4,614 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,704 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	long long x,y;
	cin >> x >> y;
	long long x2,y2;
	cin >> x2 >> y2;
	long long count = 0;
	long long a = 0, b = 0;
	while(1){
		if(a == x and b == y) break;
		if(x > a) a++;
		else if(x < a) a--;
		if(y > b) b++;
		else if(y < b) b--;
		if(a == x2 and b == y2) b--;
		count++;
	}
	cout << count << endl;
	return 0;
}
0