-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16431.cpp
More file actions
37 lines (31 loc) · 782 Bytes
/
16431.cpp
File metadata and controls
37 lines (31 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 16431. 베시와 데이지
// 2021.04.19
// 수학
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
pair<int, int> bessie;
pair<int, int> daisy;
pair<int, int> john;
cin >> bessie.first >> bessie.second >> daisy.first >> daisy.second >> john.first >> john.second;
// 데이지가 존에게 가는 최소 시간
int d = abs(john.first - daisy.first) + abs(john.second - daisy.second);
// 베시가 존에게 가는 최소 시간
int b = max(abs(john.first - bessie.first), abs(john.second - bessie.second));
if (d > b)
{
cout << "bessie" << endl;
}
else if (b > d)
{
cout << "daisy" << endl;
}
else
{
cout << "tie" << endl;
}
return 0;
}