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 |
俺叫大飞,用DFS要跑32MS,汗,望大牛指点。void dfs(int d) { int m,n; if(f=='y') return; if(d>=10) { e[0]=w[1]+w[2]+w[4]; e[1]=w[1]+w[2]+w[3]+w[5]; e[2]=w[2]+w[3]+w[6]; e[3]=w[1]+w[4]+w[5]+w[7]; e[4]=w[1]+w[3]+w[5]+w[7]+w[9]; e[5]=w[3]+w[5]+w[6]+w[9]; e[6]=w[4]+w[7]+w[8]; e[7]=w[5]+w[7]+w[8]+w[9]; e[8]=w[6]+w[8]+w[9]; for(m=0;m<9;m++) if((e[m]+clock[m/3][m%3])%4!=0) return; for(m=1;m<10;m++) for(n=0;n<w[m];n++) cout<<m<<' '; f='y'; return; } for(m=0;m<4;m++) { flag[d]=m; dfs(d+1); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator