-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircleSquar
45 lines (41 loc) · 872 Bytes
/
CircleSquar
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
38
39
40
41
42
43
44
45
#include <bits/stdc++.h>
using namespace std;
int pixelDistance(int x1, int y1, int x2, int y2){
int xTerm = (x1 - x2)^2;
int yTerm = (y1 - y2)^2;
return sqrt(xTerm + yTerm);
}
int main(){
int w;
int h;
cin >> w >> h;
int circleX;
int circleY;
int r;
cin >> circleX >> circleY >> r;
int x1;
int y1;
int x3;
int y3;
cin >> x1 >> y1 >> x3 >> y3;
// your code goes here
for(int y = 0; y < h; y++){
for(int x = 0; x < w; x++){
if(y == circleY && x == circleX){
cout << "#";
}
else if(pixelDistance(x, y, circleX, circleY) <= r){
cout << "#";
}
else if(y == y1 && x == x1
|| y == y3 && x == x3){
cout << "#";
}
else{
cout << ".";
}
}
cout << endl;
}
return 0;
}