@tendua.....ya i was wrong i got it...

2011/7/15 ●αηυяαg ∩ ℓιƒє ≈ Φ <[email protected]>

> #include<iostream>
> #include<vector>
> #include<cstring>
>
> using namespace std;
>
> bool mark[20];
> vector<int> v[20];
> int count=0,n;
>
> void solve(int row)
> {
>        if(row==n)count++;
>
>        else
>        for(int i=0;i<v[row].size();i++)
>        {
>                if(!mark[v[row][i]])
>                {
>                        mark[v[row][i]]=true;
>                        solve(row+1);
>                        mark[v[row][i]]=false;
>                }
>        }
> }
>
> int main()
> {
>        int x;
>        cin>>n;
>        for(int i=0;i<n;i++)
>        for(int j=0;j<n;j++)
>        {
>                cin>>x;
>                if(x)v[i].push_back(j);
>        }
>
>        memset(mark,false,sizeof(mark));
>        solve(0);
>
>        cout<<count<<endl;
> }
>
>
> On Jul 14, 11:23 pm, shilpa gupta <[email protected]> wrote:
> > if we have to find out no of possible outputs ...........then we can do
> this
> > for(i=1;i<=n;i++)
> > {
> > ans=ans * no of 1s in ith row
> > return(ans);}
> >
> > On Thu, Jul 14, 2011 at 11:46 PM, SkRiPt KiDdIe <[email protected]
> >wrote:
> >
> >
> >
> > > Will a Back-tracking solution suffice..??
> >
> > >  --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.> To post to this group, send email
> [email protected].
> > > To unsubscribe from this group, send email to>
> [email protected].
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > shilpa gupta
> > b tech 2nd year
> > computer science and engineering
> > mnnit allahabad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
shilpa gupta
b tech 2nd year
computer science and engineering
mnnit allahabad

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to