Simple Fun #4: Phone Call

2017/12/23 posted in  codeWars


#import <Foundation/Foundation.h>
int phoneCall(int min1, int min2_10, int min11, int s) {
    if (s<min1) return 0;
    int sum = 1;
    sum+= (s-min1)>min2_10*9 ? 9 : (s-min1)/min2_10;
    sum+= (s-min1-9*min2_10)<0 ? 0 : (s-min1-9*min2_10)/min11;
    return sum;
}