This repository was archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfolding.java
More file actions
63 lines (56 loc) · 1.47 KB
/
folding.java
File metadata and controls
63 lines (56 loc) · 1.47 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
59
60
61
62
63
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;
public class folding {
public static boolean isOdd(double num) {
System.err.println(num+" ");
if(num==1.0||num==1||num==-1||num==-1.0) {
return true;
}
num++;
return ((Math.abs(num)%2)==1)||num==1.0;
}
public static void main(String[] args)throws IOException {
// TODO Auto-generated method stub
BufferedReader f=new BufferedReader(new FileReader("10.in"));
PrintWriter pw=new PrintWriter(new FileWriter("folding.out"));
StringTokenizer st=new StringTokenizer(f.readLine());
final int N=Integer.parseInt(st.nextToken());
final int L=Integer.parseInt(st.nextToken());
Queue<Integer> queue = new PriorityQueue<Integer>(N, null);
for(int i=0;i<N;i++) {
queue.add(Integer.parseInt(f.readLine()));
}
int max;
int prev=-1;
double test;
for(int i=0;i<N;i++) {
max=0;
test=queue.poll();
for(double test1:queue) {
if(test==1) {
test=-2;
}
if(test1==0) {
test1=1;
}
if(isOdd((test-test1))) {
max++;
System.out.println("OMG "+System.nanoTime());
}
System.out.println(test+" "+test1+" "+(test1-test));
}
if(max>prev) {
prev=max;
}
}
pw.println(prev);
f.close();
pw.close();
}
}