题目如下:


思路一:
全排列后找到火星人表示的排序,然后再往后排序m次即可。
看了下数据,肯定超时,放弃。
思路二:
改进思路一,直接在全排列中找到外星人的排序。
可以试试
我的代码:
import java.io.*;
public class Main {
static int n;
static int m;
static boolean bool = true;
static int ct = 0;
static int[] ints; // 对比用的
static boolean[] pd; // 看intz【】是否被征用
static int[] cc; // 存储当前的数据
static StringBuilder str = new StringBuilder();
static BufferedReader ins = new BufferedReader(new InputStreamReader(System.in));
static StreamTokenizer in = new StreamTokenizer(ins);
static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException{
in.nextToken();
n = (int)in.nval;
in.nextToken(