HDU4576 A very hard mathematic problem(很好的搜索)
来源:互联网 发布:传至大数据3期百度云 编辑:程序博客网 时间:2024/05/22 11:40
#include<iostream>#include<cmath>#include<cstdio>using namespace std;typedef long long ll;ll power(ll a,ll n){ ll ans=1; while(n>0){ if(n&1) ans*=a; a=a*a;//a=a的 2的i次方 的次方 // a a^2 a^2*a^2=a^4 a^4*a4=a^8 n>>=1; } return ans;}ll k;ll sum;int main(){ while(scanf("%I64d",&k),k!=0){ sum=0; ll t=sqrt(k); if(t*t==k)sum+=(t-1)/2; for(int z=3;z<32;z++){ //if(power(2,z)>=k) break; for(int x=1;;x++){ ll u=power(x,z); if(2*u>=k)break; for(int y=x+1;;y++){ ll v=power(y,z); if(v+u+x*y*z>k)break; if(u+v+x*y*z==k)sum++; } } } printf("%I64d\n",sum); } return 0;}
阅读全文
0 0
- HDU4576 A very hard mathematic problem(很好的搜索)
- HDU4282 A very hard mathematic problem(二分搜索)
- A very hard mathematic problem(二分法)
- A very hard mathematic problem(二分)
- A very hard mathematic problem
- A very hard mathematic problem
- 【二分搜索】 hdu4282 A very hard mathematic problem
- 【暴力搜索】-HDU-4282-a very hard mathematic problem
- A very hard mathematic problem(天津online)
- HDU 4282 A very hard mathematic problem(暴力优化)
- hdu 4282 A very hard mathematic problem(二分)
- HDU 4282A very hard mathematic problem(二分)
- hdu 4282 A very hard mathematic problem
- Hdu 4282 A very hard mathematic problem
- hdu4282 A very hard mathematic problem
- hdu 4282 A very hard mathematic problem
- hdu 4282 A very hard mathematic problem
- E - A very hard mathematic problem题解
- 读书笔记《Effective C++》条款36:绝不重新定义继承而来的non-virtual函数
- 网站异常发送异常代码到邮箱
- ios 代理、block和通知
- C#167课的主要内容
- c语言排序
- HDU4576 A very hard mathematic problem(很好的搜索)
- MySQL 'root'@'localhost'无法登录
- centos安装apche
- 高并发服务器架构笔记(3)——muduo_base 源码分析
- 坚持#第181天~海贼王
- Building Apps with Content Sharing
- css3 flexbox layout(弹性布局)完全解析
- 使用python Tkinter制作一个可以生成重复文本片段的小工具
- 解决Maven更新后错误Dynamic Web Module 3.0 requires Java 1.6 or newer