FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/fenceplan.java at master · javaarchive/Java · GitHub
This repository was archived by the owner on Feb 29, 2024. It is now read-only.
javaarchive
/
Java
Public archive
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
3
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
fenceplan.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
48 lines (46 loc) · 1.28 KB
Breadcrumbs
Java
/
fenceplan.java
Copy path
File metadata and controls
48 lines (46 loc) · 1.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
46
47
48
import
java
.
io
.*;
import
java
.
util
.*;
public
class
fenceplan
{
// Func Ref
// Output values
// 0 = p, q, r colinear
// 1 = Clockwise
// 2 = Counterclockwise
static
int
[][]
matrix
;
static
Point
[]
graph
;
public
static
int
orientation
(
Point
p
,
Point
q
,
Point
r
)
{
int
val
= (
q
.
y
-
p
.
y
) * (
r
.
x
-
q
.
x
) -
(
q
.
x
-
p
.
x
) * (
r
.
y
-
q
.
y
);
if
(
val
==
0
)
return
0
;
// collinear
return
(
val
>
0
)?
1
:
2
;
// clock or counterclock wise
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
BufferedReader
f
=
new
BufferedReader
(
new
FileReader
(
"fenceplan.in"
));
StringTokenizer
st
=
new
StringTokenizer
(
f
.
readLine
());
int
N
=
Integer
.
parseInt
(
st
.
nextToken
());
int
M
=
Integer
.
parseInt
(
st
.
nextToken
());
prev
=
new
int
[
N
];
matrix
=
new
int
[
N
][
N
];
graph
=
new
Point
[
N
];
for
(
int
i
=
0
;
i
<
N
;
i
++) {
st
=
new
StringTokenizer
(
f
.
readLine
());
int
x
,
y
;
x
=
Integer
.
parseInt
(
st
.
nextToken
());
y
=
Integer
.
parseInt
(
st
.
nextToken
());
graph
[
i
] =
new
Point
(
x
,
y
);
}
Arrays
.
fill
(
prev
, -
1
);
}
static
int
[]
prev
;
public
void
crawl
(
int
k
) {
}
}
class
Point
{
int
x
=
0
;
int
y
=
0
;
public
Point
() {}
public
Point
(
int
x
,
int
y
) {
this
.
x
=
x
;
this
.
y
=
y
;
}
}
Back
|
FazBrowse Home
|
New Git URL