摘要:
手写的next_permutation比库函数写的高了一倍的时间额。CODE:#include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;intmain(){intT;scanf("%d",&T);while(T--){intN,H;chars[20]={'\0'};scanf("%d%d",&N,&H);f 阅读全文
摘要:
#include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;chars[11];intmain(){inttimes=0;intT;scanf("%d",&T);while(T--){scanf("%s",s);intn=strlen(s);sort(s,s+n);do{printf("%s\n",s);}while(n 阅读全文
摘要:
#include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;chars[210];intmain(){while(~scanf("%s",s)){intn=strlen(s);sort(s,s+n);do{printf("%s\n",s);}while(next_permutation(s,s+n));}return0;} 阅读全文
摘要:
无耻地使用了STL,BS自己。关于next_permutation的用法:http://www.slyar.com/blog/stl_next_permutation.htmlCODE:#include<iostream>#include<algorithm>#include<cstdlib>#include<cstdio>#include<cstring>usingnamespacestd;inta[1001];chars[1001];intmain(){while(scanf("%s",s)&& 阅读全文
摘要:
Sample Input2-20 20-30 20-10 -5010 -50Sample Output0 1 (-100 21)错误的测试数据,害人。CODE:#include<iostream>#include<cstdio>#include<cstring>usingnamespacestd;structnode{intx,y;}a[1001];intcnt;voidget(intn){inti,j,k;intcnt1,cnt2;for(i=-100;i<=100;i++){for(j=-100;j<=100;j++){cnt1=cnt2=0 阅读全文