int search(int a, int b, int c, int q){ int index = 0; if(c == 1){ if((q-a)%b == 0)return 1; else return 0; } while(1){ int num = a*pow(c,index); // 超过上限,这里可能有问题,过不了再说,miao的 if(num > q || num <= 0){ break; } if((q - num)%b==0){ return 1; } index++; } return 0; }
点赞 1

相关推荐

2025-12-16 17:17
门头沟学院 产品经理
烤点老白薯:他第二句话的潜台词是想让你帮他点个瑞幸或者喜茶啥的
mt对你说过最有启发的一...
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务