Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
ft! 用G++ printf TLE, cout AC. 是我的问题吗?#include <cstdio> #include <iostream> #include <algorithm> using namespace std; int main(){ int n, k, m, a[2000]; scanf("%d",&m); while (m--){ scanf("%d%d",&n,&k); for (int i=0;i<n;++i) scanf("%d",a+i); while (k--) next_permutation(a,a+n); for (int i=0;i<n;++i) printf("%d%c",a[i],i==n-1?'\n':' '); } return 0; } printf("%d%c",a[i],i==n-1?'\n':' '); 跟 cout << a[i] << (i==n-1?'\n':' '); Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator