Codeforces Round #592 (Div. 2) C - The Football Season(推公式)

Posted herlo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Codeforces Round #592 (Div. 2) C - The Football Season(推公式)相关的知识,希望对你有一定的参考价值。

?? ?? ??

题意加题解:

技术图片

//x*w+y*d=p;
//x+y+z=0
int main()
{
    ll n,p,w,d;
    cin>>n>>p>>w>>d;
    ll y=0;
    while(y<w&&(p-d*y)%w) ++y;
    if(y==w) return puts("-1"),0;
    ll x=(p-d*y)/w;
    if(x<0||x+y>n) return puts("-1"),0;
    cout<<x<<" "<<y<<" "<<n-x-y<<" ";
    //stop;
    return 0;
}

以上是关于Codeforces Round #592 (Div. 2) C - The Football Season(推公式)的主要内容,如果未能解决你的问题,请参考以下文章

Codeforces Round #592 (Div. 2)

Codeforces Round #592 (Div. 2)

Codeforces Round #592 (Div. 2) E

Codeforces Round #592 (Div. 2) CF1244A Pens and Pencils题解

Codeforces Round #592 (Div. 2) C - The Football Season(推公式)

Codeforces Round #328(Div2)