import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer sb=new StringBuffer("");
int testcases=Integer.parseInt(br.readLine());
for (int i = 0; i 50)
System.exit(0);
int a[]=new int[L];
String s[]=br.readLine().split(" ");
for(int j=0;ja[j2])
{
int temp=a[j2];
a[j2]=a[j];
a[j]=temp;
swapcount++;
}
}
}
sb.append("Optimal train swapping takes "+swapcount+" swaps.\n");
}
System.out.print(sb);
}
}
0 comments: