水题,STL双端队列。
1 /* 2319 */ 2 #include3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 9 int main() {10 int n, t;11 int i, j, k;12 deque Q;13 14 #ifndef ONLINE_JUDGE15 freopen("data.in", "r", stdin);16 #endif17 18 scanf("%d", &t);19 while (t--) {20 scanf("%d", &n);21 Q.push_front(n);22 for (i=n-1; i>=1; --i) {23 Q.push_front(i);24 for (j=0; j