1 solutions

  • 0
    @ 2022-2-8 11:51:42

    #include<bits/stdc++.h>

    using namespace std;

    typedef long long ll;

    int x,k,c;

    ll m; bool f(int x, ll m, int k, int c) {

    ll y=0;
    
    for (int i = 0; i < m; i++) {
    	y+=((x%k)*((ll)pow(10,i)%k))%k;
    }
    if (y == c) return true;
    else return false;
    

    }

    int main() {

    cin >> x >> m >> k >> c;
    
    if (f(x, m, k, c))cout << "Yes" << endl;
    
    else cout << "No" << endl;
    
    return 0;
    

    }

    • 1

    Information

    ID
    1552
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    (None)
    # Submissions
    18
    Accepted
    14
    Uploaded By