京东第二题,为啥我的暴力只过了18%,是我太暴力了吗?
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ long n = sc.nextLong(); long[] a = new long[(int) n]; long[] b = new long[(int) n]; long[] c = new long[(int) n]; for(long i = 0; i<n; i++){ a[(int) i] = sc.nextLong(); b[(int) i] = sc.nextLong(); c[(int) i] = sc.nextLong(); } int s = 0; for(long j = 0; j<n; j++){ for(long k = 0; k<n; k++){ if((a[(int) j] < a[(int) k])&&(b[(int) j] < b[(int) k])&&(c[(int) j] < c[(int) k])) { s++; } } } System.out.println(s); } sc.close(); } }
#京东##笔试题目#