Advertisement
ekzolot

Untitled

Apr 20th, 2022
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. int main(){
  5.     int a, b;
  6.     cin>>a>>b;
  7.     vector <bool> dp(10001);
  8.     dp[a]=true;
  9.     for (int i=0; i<1000; i++){
  10.         for (int j=0; j<=10000; j++){
  11.             if (dp[j]){
  12.                 dp[(7*j+2)%10000]=1;
  13.                 dp[(2*j+7)%10000]=1;
  14.             }
  15.         }
  16.     }
  17.     if (dp[b]){
  18.         cout<<"Yes"<<endl;
  19.     }
  20.     else{
  21.         cout<<"No"<<endl;
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement