#include #define rep(i,n) for(i=0;i maxR) { //~ printf("ratio: %f\n",ratio); maxR = ratio; int cnt = M / buy; int prof = (M%buy + cnt * sell) - M; if(maxProf < prof) maxProf = prof; } //~ int cnt = M / buy; //~ int prof = (M%buy + cnt * sell) - M; //~ if(maxProf < prof) maxProf = prof; } } //~ printf("%d\n", maxDelta * cntGlob); printf("%d\n", maxProf); } return 0; }