HDU 2401 Baskets of Gold Coins

 

http://acm.hdu.edu.cn/showproblem.php?pid=2401

水。。

View Code
#include <iostream>

using namespace std ;

int main()

{

    int n,w,d,s ;

    while(~scanf("%d%d%d%d",&n,&w,&d,&s))

    {

        if(w*n*(n-1)/2==s)

            printf("%d\n",n) ;

        else

            printf("%d\n",(w*n*(n-1)/2-s)/d) ;

    }

    return 0 ;

} 

 

你可能感兴趣的:(HDU)