Find the player who will win by choosing a number in range [ 1 , K ] with sum total N | C ++ program for above approach ; Function to predict the winner ; Driver Code ; Given Input ; Function call
#include <iostream> NEW_LINE using namespace std ; void predictTheWinner ( int K , int N ) { if ( N % ( K + 1 ) == 0 ) cout << " Bob " ; else cout << " Alice " ; } int main ( ) { int K = 7 , N = 50 ; predictTheWinner ( K , N ) ; return 0 ; }