-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmoocast.java
More file actions
58 lines (46 loc) · 1.34 KB
/
moocast.java
File metadata and controls
58 lines (46 loc) · 1.34 KB
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
49
50
51
52
53
54
55
56
57
58
import java.io.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.StringTokenizer;
class node{
int x;
int y;
int pow;
@Override
public String toString() {
return x+" "+y+" "+pow;
}
}
public class moocast {
public static boolean canreach(node start, node end){
if(Math.sqrt(Math.pow((start.x-end.x),2)+Math.pow((start.y-end.y),2))<=start.pow){
return true;
}
return false;
}
public static int flow(ArrayList<node> unvisted, node cur){
int count = 1;
if(unvisted.size()==0){
return 2;
}
for(int i = 0; i<unvisted.size();i++){
node s = unvisted.get(i);
if(canreach(cur,s)){
unvisted.remove(i);
i--;
count+=flow(unvisted,s);
//unvisted.add(s);
}
}
return count;
}
public static void main(String[] args) throws IOException {
// write your code here
BufferedReader f = new BufferedReader(new FileReader("moocast.in"));
// input file name goes above
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("moocast.out")));
int num = Integer.parseInt(f.readLine());
ArrayList<node> ad = new ArrayList<node>();
out.close();
}
}