标签:put ++ set div turn article for pos ret
#include<stdio.h> #include<string.h> int nTestCase[300001]; int nNumbers[32001]; int main() { freopen("sample_input.txt","r",stdin); int i, j, test, currrank, n, max; scanf("%d", &test); while (test--){ currrank = 1; max = 0; scanf("%d", &n); memset(nNumbers, 0, 32000 * sizeof(int)); for (i = 1; i <= n; i++){ scanf("%d", &nTestCase[i]); nNumbers[nTestCase[i]]++; max = max<nTestCase[i] ?nTestCase[i] : max; } for (i = max; i>0; i--){ if (nNumbers[i]){ j = nNumbers[i]; nNumbers[i] = currrank; currrank += j; } } for (i = 1; i <= n; i++) printf("%d ", nNumbers[nTestCase[i]]); printf("\n"); } return 0; }
标签:put ++ set div turn article for pos ret
原文地址:http://www.cnblogs.com/gavanwanggw/p/7221007.html