All pastes #935089 Raw Edit

Anonymous

public cpp v1 · immutable
·published 2008-03-09 10:51 UTC
rendered paste body
#include<iostream>#include<vector>#include<algorithm>#include<string>#include<math.h>using namespace std;bool check(string a,int n);int prob5(int n);int main(){   int vount=prob5(5);   cout<<endl<<vount-1;   getchar();   return 0;}int prob5(int n){    int vount=0;               string v;    for(int i=0;i<n;i++)            v[i]='0';      //      cout<<"hi";    for(int i=0;i<pow(3,n);i++)    {                    if( check(v,n))          {          for(int k=0;k<n;k++)                  cout<<v[k]<<" ";          vount++;          }          cout<<endl;                      for(int j=n-1;j>=0;j--)                  {                         //cout<<"hi";                       if(v[j]=='2')                                                       v[j]='0';                        else                        {                             v[j]++;                            break;                        }                  }                 //   getchar();                             }    return vount;    }bool check(string a,int n){     int ans=0;     for(int i=0;i<n;i++)     {            ans+=a[i];         }       if(ans%2==0)     return true;}