Total passenger garlic --- mercenaries

Encounter a problem bit mean ~

Topics address

 

 

 

#include<stdio.h>
int aaa(int a,int b){
    int re;
    if( a%b != 0){
        return 1+(a/b);
    }else{
        return (a/b);
    }
}
int main(){
    int M,N,X;
    scanf("%d %d %d",&M,&N,&X);
    int m = 0;
    while(N <= M){
        X = X - aaa(M,N);
        if(X > 0){
            N = N + M/N;
        }else if(X == 0){
            N = N + M/N;
            break;
        }else{
            m = N;
            break;
        }
    }
    if(X  < 0){
        printf("%d",m);
    }
    else
        printf("%d",N);
    return 0;
}

Difficult to difficult, the whole simulation on it

However, the analysis process can exercise particular ~~~ Thought the last  N + M = N / N;   calculated on the final physical value and determined     very idea of exercise. . . 

 

Guess you like

Origin www.cnblogs.com/expedition/p/11574857.html