锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
public class Permutation
{
static int n;
static int[] a;

static boolean ifok(int k, int i)
{
if (k < i)
{
for (int t = k; t < i; t++)
{
if (a[t] == a[i])
return false;
}
}
return true;
}

static void search(int k)
{
if (k == n)
{
for (int i : a)
{
System.out.print(i + "銆");
}
System.out.println();
return;
}
for (int i = k; i < n; i++)
{
if (ifok(k, i))
{
int tmp = a[k];
a[k] = a[i];
a[i] = tmp;
search(k + 1);
tmp = a[k];
a[k] = a[i];
a[i] = tmp;
}
}
}

public static void main(String[] args)
{
int a1[] =
{ 1, 1, 2, 2 };
n = a1.length;
a = a1;
Arrays.sort(a);
search(0);
}
}
]]>

public static void main(String[] arg) throws IOException
{
FileWriter q = new FileWriter(
new File("c:\\1.txt"));
BufferedWriter k=new BufferedWriter(q);
k.write("asdsad");
k.close();
}
class data implements Comparable
{
int a;
int b;
@Override
public int compareTo(Object o)
{
return a - ((data) o).a;
}
public String toString()
{
return Integer.toString(this.a)+"::"+Integer.toString(this.b);
}
}
public class test
{
public static void main(String[] args)
{
data[] temp = new data[10];
PriorityQueue<data> q=new PriorityQueue<data>();
for (int i = 0, j = 10; i < 10; i++, j--)
{
temp[i] = new data();
temp[i].a = j;
temp[i].b = i;
q.add(temp[i]);
}
//Arrays.sort(temp);
while(q.peek()!=null)
{
System.out.println(q.remove()+" ");}
}
}
String a="1,2|3 4,5:6,7,8";
StringTokenizer test=new StringTokenizer(a," ,:|");
while(test.hasMoreTokens())
{
System.out.print(test.nextToken());
}
//鏂規硶浜?==================================
class data implements Comparable
{
int a;
int b;
@Override
public int compareTo(Object o)
{
return a - ((data) o).a;
}
public String toString()
{
return Integer.toString(this.a)+","+Integer.toString(this.b);
}
}
public class test
{
public static void main(String[] args)
{
data[] temp = new data[10];
for (int i = 0, j = 10; i < 10; i++, j--)
{
temp[i] = new data();
temp[i].a = j;
temp[i].b = i;
}
Arrays.sort(temp);
System.out.println(Arrays.asList(temp));
}
}
import java.math.*;
import java.util.*;
import java.io.*;
//鏂規硶涓===============================================================
class data
{
public int i;
public int j;
}

class cmp implements Comparator
{
@Override
public int compare(Object o1, Object o2)
{
return ((data) o1).i - ((data) o2).i;//浠庡皬鍒板ぇ
// return 0;
}
}

public class test
{

public static void main(String[] arg)
{
data[] a = new data[10];

for(int i=0,j=10;i<10;i++,j--)
{
a[i]=new data();//姣忔蹇呴』鍒濆鍖?br>27
a[i].i=i;
a[i].j=j;
}
Arrays.sort(a,new cmp());

for(int i=0;i<10;i++)
{
System.out.print(a[i].i+" ");
}
}
}

public static void main(String[] arg) throws IOException
{
FileReader q = new FileReader(
"G:\\project\\java\\topcoder\\test\\src\\test.java");
BufferedReader k = new BufferedReader(q);
String s;
while ((s = k.readLine()) != null)
{
System.out.println(s);
}
}