#14799: 來自台灣的小福利


Aaaaaaaaaaaaa (羅傑)

學校 : 臺北市立大同高級中學
編號 : 69102
來源 : [111.235.208.242]
最後登入時間 :
2023-09-13 09:02:41
d575. 末日審判 -- jack1 | From: [203.72.178.252] | 發表日期 : 2018-08-06 14:24

#include <iostream>

using namespace std;

int main(){
ios::sync_with_stdio(false);

long long int x1, y1, x2, y2, r, k = 1;

while (cin >> x1 >> y1 >> x2 >> y2 >> r){

for (int i = 0; i < 2; i++){

if (abs(x2 - x1) > r || abs(y2 - y1) > r){

k = 0;

}

else if (x1 < x2 && (x2 - x1) <= r){

r = r - (x2 - x1);

x1 = x2;

}

else if (x1 > x2 && (x1 - x2) <= r){

r = r - (x1 - x2);

x1 = x2;

}

else if (x1 == x2){

if (y1 < y2 && (y1 - y2) <= r){

r = r - (y1 - y2);

y1 = y2;

k = 1;

}

else if (y1 > y2 && (y1 - y2) <= r){

r = r - (y1 - y2);

y1 = y2;

k = 1;

}

y1 == y2 ? k = 1 : k = 0;

}

else{

k = 0;

}

}

k == 1 ? cout << "die\n" : cout << "alive\n" ;

k = 1;

}

return 0;

}

 
ZeroJudge Forum