#include<stdio.h> int main() { int t, n, i, j,; scanf("%d", &t); while(t--) { scanf("%d", &n); int s[n]; for(i=0; i<n; i++) scanf("%d", &s[i]); int temp; for(i=0; i<n; i++){ for(j=i; j<n; j++) { if(s[i] > s[j]) { temp = s[i]; s[i] = s[j]; s[j] = temp; } } } int max = s[0]; for(i=0; i<n; i++) { if(s[i] * (n-i) > max) max = s[i] * (n-i); } printf("%d\n", max); } return 0; } /* Main.c: In function 'main': Main.c:4:17: error: expected identifier or '(' before ';' token int t, n, i, j,; ^ */ |
Double click to view unformatted code.