跳到正文

个人记录

找到我的主页—7

wuyi2026约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年7月14日
篇幅
约 1 分钟

版本

  1. v1当前

#include<bits/stdc++.h> using namespace std; int tzk(){ long long n,x; cin>>n>>x; if(x==1)return(n&(n-1))==0; long long s=0,cnm=n; while(cnm!=0){ s+=cnm%x; cnm/=x; } long long d=x-1; for(long long p=1;p<=n;p*=2){ if(p>=s&&(p-s)%d==0){ return 1; } } return 0; } int main(){ int t; cin>>t; while(t—){ if(tzk()==1)cout<<“Yes”<<endl; else cout<<“No”<<endl; } return 0; }

原文