1 条题解
-
0
C++ :
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #define N 1000010 using namespace std; int k; int judge(int x) { if(x==k) return 1; if((x-1)%3==0&&(x-1)%2==0) return (judge((x-1)/3)||judge((x-1)/2)); if((x-1)%3==0) return judge((x-1)/3); if((x-1)%2==0) return judge((x-1)/2); return 0; } int main() { int x; scanf("%d,%d",&k,&x); if(judge(x)) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
- 1
信息
- ID
- 3887
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者