Untitled

 avatar
ducsieumanh1hitlanamguku
plain_text
14 days ago
325 B
2
Indexable
Never
int tinh2 (int c,int base,int n) {
    int tong=n/(base*10);
    int cur=(n/base)%10;
    int ans=n%base;
    int dem=tong*base;
    if (c<cur) {
        dem+=base;
    }
    else if (c==cur) {
        dem+=ans+1;
    }
    if (c==0) {
        dem-=base;
        if (tong==0) return 0;
    }
    return dem;
}
Leave a Comment