Example #1
0
bool RRSchedule::add_game_with_feas_check(int home, int away)
{
    if (check_feasible(home, away))
        return add_game(home, away);
    else
        return false;
}
Example #2
0
 int numDecodings(string s) 
 {
     if (s.empty()) return 0;
     if (s.size() == 1) return check_feasible(s[0]);
     
     int *f = new int [s.size()];
     
     f[0] = check_feasible(s[0]);
     f[1] = f[0] * check_feasible(s[1]) + check_feasible(s[0],s[1]);
     
     for (int i=2;i<s.size();++i)
         f[i] = f[i-1] * check_feasible(s[i]) + f[i-2] * check_feasible(s[i-1], s[i]);
     int ans = f[s.size() - 1];
     
     // for (int i=0;i<s.size();++i)
     //     cout << f[i] << " ";
     // cout << endl;
     
     delete [] f;
     return ans;
 }