第一题:排列字母
import java.io.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException {
// char[] s = br.readLine().toCharArray();
// Arrays.sort(s);
// for(int i = 0; i < s.length; i++){
// out.print(s[i]);
// }
out.println("AAAEEEEEEHHHIIILLRRRSSTTWWWY");
out.flush();
}
}
第二题:GCD
import java.util.Scanner;
public class Main {
static long gcd(long a, long b) {
return b == 0?a:gcd(b, a%b);
}
public static void main(String[] args) throws Exception{
Scanner s = new Scanner(System.in);
long a = s.nextLong();
long b = s.nextLong();
long r = a % (b - a);
if(r == 0) System.out.println(0);
else {
System.out.println(b-a-r);
}
}
}
![](https://i-blog.csdnimg.cn/blog_migrate/266a777e1691942f4dec67252f61c651.png)
第三题:选数异或
性价比低。
第四题:背包与魔法
缓缓~~~