标签:des blog http io ar os sp for strong
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 1033 | Accepted: 606 |
Description
a 1
b 2
...
z 26
aa 27
ab 28
...
snowfall 157,118,051,752
...
Input
Output
Sample Input
29697684282993 transcendental 28011622636823854456520 computationally zzzzzzzzzzzzzzzzzzzz *
Sample Output
elementary 29,697,684,282,993 transcendental 51,346,529,199,396,181,750 prestidigitation 28,011,622,636,823,854,456,520 computationally 232,049,592,627,851,629,097 zzzzzzzzzzzzzzzzzzzz 20,725,274,851,017,785,518,433,805,270
Source
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
char chess[10][10];
int col[10];
int n,m,ans;
void dfs(int row,int num)
{
int i,j;
if(num==m)
{
ans++;
return;
}
for(i=row+1;i<=n;i++)
for(j=1;j<=n;j++)
if(chess[i][j]!=‘.‘ && !col[j])
{
col[j]=1;
dfs(i,num+1);
col[j]=0;
}
}
int main()
{
int i;
while(cin>>n>>m)
{
ans=0;
if(n==-1 && m==-1)break;
memset(col,0,sizeof(col));
for(i=1;i<=n;i++)
cin>>chess[i]+1;
dfs(0,0);
cout<<ans<<endl;
}
return 0;
}
标签:des blog http io ar os sp for strong
原文地址:http://www.cnblogs.com/a972290869/p/4101052.html