程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> C語言 >> C++ >> C++入門知識 >> DFS FZU 2107

DFS FZU 2107

編輯:C++入門知識

DFS FZU 2107


Problem 2107 Hua Rong Dao

Accept: 247 Submit: 555
Time Limit: 1000 mSec Memory Limit : 32768 KB

\ Problem Description

Cao Cao was hunted down by thousands of enemy soldiers when he escaped from Hua Rong Dao. Assuming Hua Rong Dao is a narrow aisle (one N*4 rectangle), while Cao Cao can be regarded as one 2*2 grid. CrZ†·Ÿ"http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vc3MgZ2VuZXJhbCBjYW4gYmUgcmVnYXJkZWQgYXMgb25lIDEqMiBncmlkLlZlcnRpY2FsIGdlbmVyYWwKIGNhbiBiZSByZWdhcmRlZCBhcyBvbmUgMioxIGdyaWQuIFNvbGRpZXJzIGNhbiBiZSByZWdhcmRlZCBhcyBvbmUgMSoxIGdyaWQuIE5vdyBIdWEgUm9uZyBEYW8gaXMgZnVsbCBvZiBwZW9wbGUsIG5vIGdyaWQgaXMgZW1wdHkuPC9wPgo8cD48L3A+CjxwPlRoZXJlIGlzIG9ubHkgb25lIENhbyBDYW8uIFRoZSBudW1iZXIgb2YgQ3Jvc3MgZ2VuZXJhbCwgdmVydGljYWwgZ2VuZXJhbCwgYW5kIHNvbGRpZXIgaXMgbm90IGZpeGVkLiBIb3cgbWFueSB3YXlzIGNhbiBhbGwgdGhlIHBlb3BsZSBzdGFuZD88L3A+Cgo8aDI+PGltZyBzcmM9"https://www.aspphp.online/bianchen/UploadFiles_4619/201701/2017012113311742.gif" alt="\"> Input

There is a single integer T (T¡Ü4) in the first line of the test data indicating that there are T test cases.

Then for each case, only one integer N (1¡ÜN¡Ü4) in a single line indicates the length of Hua Rong Dao.

\ Output

For each test case, print the number of ways all the people can stand in a single line.

\ Sample Input

212

\ Sample Output

018

\ Hint

Here are 2 possible ways for the Hua Rong Dao 2*4.

\

\ Source

¡°¸ß½ÌÉç±­¡±µÚÈý½ì¸£½¨Ê¡´óѧÉú³ÌÐòÉè¼Æ¾ºÈü
//ÓÃËÑË÷À´¼Ç¼À´Í³¼ÆÓжàÉÙÖÖÇé¿ö
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define MAXN 6
int vis[MAXN][MAXN];
int n,m;
int flag;
int ans;

bool f(int x,int y){
    if(x>=n || x<0 || y>=4 || y<0){
        return false;
    }
    return true;
}

void DFS(int con){
    int i,j;
    if(flag==1 && con==n*m){
        ans++;
        //flag = 0;
        return ;
    }
    if(con > n*m){
        return ;
    }
    for(int i=0;i

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved