NC222874. IndustrialNuclearWater
描述
输入描述
First line contains one integer ().
Next lines, the -th line contains 6 integers (), indicating the -th query.
输出描述
lines, in the -th line print `Yes` if the drinkable water can reach Baby Kingdom, print `No` otherwise.
示例1
输入:
3 1 0 0 2 0 0 1 0 0 -1 0 0 1 0 0 1 1 0
输出:
Yes No No
说明:
In example, query 3, the surface divide is .C++ 解法, 执行用时: 3ms, 内存消耗: 384K, 提交时间: 2021-11-07 15:07:04
#include<bits/stdc++.h> using namespace std; typedef long long ll; int solve(ll x,ll y,ll z) { return (1000*llabs(x)<y*y+z*z ? 2 : x>0) * 9 + (1000*llabs(y)<x*x+z*z ? 2 : y>0) * 3 + (1000*llabs(z)<x*x+y*y ? 2 : z>0); } int main() { int cas; scanf("%d",&cas); while(cas--) { int x1,y1,z1,x2,y2,z2; scanf("%d%d%d%d%d%d",&x1,&y1,&z1,&x2,&y2,&z2); puts(solve(x1,y1,z1)==solve(x2,y2,z2) ? "Yes" : "No"); } }