sdut_oj_3068 为了相同的前缀-方程式计算
2015-12-05 01:32
204 查看
#include <iostream> using namespace std; const long long maxn=999999999; long long f(int a,int b,int c,int x) { long long ans1,s=0,ans=1; while(a--) ans*=x; ans1=ans=ans*b+c; while(ans1) { s+=ans1%10; ans1/=10; } if(s==x) return ans; else return 0; } int main() { int a,b,c,i,count1; long long t,arr[100]; while(cin>>a>>b>>c) { count1=0; for(i=1;i<=81;i++) { t=f(a,b,c,i); if(t>=1&&t<=maxn) { arr[count1++]=t; } } cout<<count1<<endl; if(count1) { for(i=0;i<count1;i++) i==0?cout<<arr[i]:cout<<' '<<arr[i]; cout<<endl; } } return 0; }
相关文章推荐
- hdu_2159_fate
- 4-4 Cube Painting
- 将kafka工程转成maven项目
- 关于QT中对窗口中某个widget建类
- Unity的C#和ObjC数据交互
- 补码转原码(算术左移一位负变正)
- arduino开发过程中编译问题undefined reference to `setup'的解决办法
- 黑马程序员--java基础-方法重载与数组
- 自定义HorizontalScrollView之侧滑
- 不刷新改变URL: pushState + Ajax
- android 开发中常见问题
- 10004---HTML框架(iframe与framset,frame)
- 百度地图应用
- duilib进阶教程 -- 总结 (17)
- 2013 duilib入门简明教程 -- 总结 (20)
- JS中获取contextPath的方法
- 页面缓存
- 利用pushState开发无刷页面切换
- Anaconda2+Theano 安装过程中的所有的坑。。。
- 【android_温故知新】第 4 组 UI 组件:AdapterView 及其子类