#include int main(){ // 野菜の数・肉の数・比率・許容量 int vegetables, meat, proportion, all; scanf("%d%d%d%d",&vegetables,&meat,&proportion,&all); // 野菜を食べた個数 int count = 0; int i = 0; while( i != all){ if(meat > proportion){ i += proportion; meat -= proportion; } if(vegetables != 0){ vegetables -= 1; i++; count++; } if(meat == 0 || vegetables == 0){ printf("%d",count); return 0; } } printf("%d",count); }