Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main(){
- int a, b;
- cin>>a>>b;
- vector <bool> dp(10001);
- dp[a]=true;
- for (int i=0; i<1000; i++){
- for (int j=0; j<=10000; j++){
- if (dp[j]){
- dp[(7*j+2)%10000]=1;
- dp[(2*j+7)%10000]=1;
- }
- }
- }
- if (dp[b]){
- cout<<"Yes"<<endl;
- }
- else{
- cout<<"No"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement