两道算法 1.给平面三个点判断能组成多少个三角形。暴力n^3过了2.给一个合数,求他的分解质因数,以每个因数的底数和指数输出,比如12 = 2 *2 * 3, 输出[[2,2],[3,1]] , 合数范围为2~2^31 - 1。只过了20%, 太菜了,后面看题解学会了。代码如下:import java.util.*;public class Main {public static void main(String[] args) {Scanner scanner = new Scanner(System.in);int n = scanner.nextInt();while (n -- > 0){int a = scanner.nextInt();for (int i = 2 ; i <= a/i ; i++){// i 为什么一定是质数? 因为如果是合数,应该被他的因子分解了已经。if (a % i == 0){int cnt = 0;while (a % i == 0){a /= i;cnt++;}System.out.println(i + " " + cnt);}}if(a > 1) System.out.println(a + " " + 1);System.out.println();}}}