1.第一题
这题是,。,,题目忘了,很多参数的样子,不过还是凭着我数学的直觉推出了里面的猫腻,很快解决了,虽然我也不知道为啥就行,真的,我觉得还有很多情况需要考虑,比如我在纠结除数怎么考虑。
import java.util.Scanner;
public class Main {
public static int max(int n, int m, int a, int b, int c, int d, int x, int y, int z) {
int temp1 = n / (a + b);
int temp2 = m / (a + b);
int temp = Math.min(temp1, temp2);
int A = (x - (b * y) / c - a * z / d);
int B = z * n / d;
int C = y * m / c;
return A * temp + B + C;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int n = sc.nextInt();
int m = sc.nextInt();
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int d = sc.nextInt();
int x = sc.nextInt();
int y = sc.nextInt();
int z = sc.nextInt();
System.out.println(n + " " + m);
System.out.println(a + " " + b + " " + c + " " + d);
System.out.println(x + " " + y + " " + z);
System.out.println("result:" + max(n, m, a, b, c, d, x, y, z));
}
}
2.第二题
第二题是求逆序对的问题,不是求出一个数字而是求出具体的每一个数对应的逆序对数。看了下归并逆序不知道怎么改。于是暴力了一下居然能过80%。。。。。
3.总结
总体来说360略坑,因为选择题真的很多C++的题,我应该抽点时间看看C++了,这样说不定还能投投C++岗,必考内容就是析构函数执行了多少次。