杭电acm2401

#include <stdio.h>

int main(){

	int n, w, d, sum, ans, t;
	while(~scanf("%d%d%d%d", &n, &w, &d, &t)){
 	    sum = n * (n-1) / 2 * w;
 	    ans = (sum - t) / d;
 	    if(sum==t)
 	    		  printf("%d\n", n);
        else
 	    printf("%d\n", ans);
	}

	return 0;
}

你可能感兴趣的:(ACM,HDU)