結果

問題 No.131 マンハッタン距離
ユーザー Lay_ecLay_ec
提出日時 2015-01-21 00:18:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 954 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 76,184 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 02:39:40
合計ジャッジ時間 1,564 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>

using namespace std;
 
const double eps=1e-10;

vector<double> X,Y,Z;
double px,py,pz;


double dist(int i,int j,int k)
{
	double vijx,vijy,vijz;
	double vikx,viky,vikz;

	vijx=X[j]-X[i];
	vijy=Y[j]-Y[i];
	vijz=Z[j]-Z[i];

	vikx=X[k]-X[i];
	viky=Y[k]-Y[i];
	vikz=Z[k]-Z[i];

	//a(x-X[i])+b(y-Y[i])+c(z-Z[i])=0
	//ax+by+cz+(-aX[i]-bY[i]-cZ[i])=0

	double a=vijy*vikz - vijz*viky;
	double b=vijz*vikx - vijx*vikz;
	double c=vijx*viky - vijy*vikx;
	double d=-a*X[i]-b*Y[i]-c*Z[i];

	double res=abs(a*px+b*py+c*pz+d)/sqrt(a*a+b*b+c*c);

	return res;

}

int main()
{

	long x,y,d;
	cin>>x>>y>>d;

	long res=0;
	if(d==0) res=1;
	else{
		if(x>=d && y>=d) res=d+1;
		else if(x+y>d) res=2;
	}

	cout<<res<<endl;

	return 0;
}
0