시도 횟수: 1회

해결한 시간: 09:32

핵심 아이디어

<aside> 💡

$x$년 후에 $Z$배가 된다고 하면

$X+x = Z(Y+x)$ 를 만족한다.

식을 정리하면

$(X-ZY) = (Z-1)x$ 가 되고 이를 만족하는 정수 $x$가 있다면 Yes

</aside>

코드

#include <bits/stdc++.h>
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
using namespace std;
typedef long long ll;

int x, y, z;

int main()
{
    FASTIO;
    cin >> x >> y >> z;
    if((x-y*z)>=0 && (x-y*z)%(z-1) == 0){
        cout << "Yes\\n";
        return 0;
    }
    else cout << "No\\n";

    

    return 0;
}

복기