b^3 - a^3 = c
生活随笔
收集整理的這篇文章主要介紹了
b^3 - a^3 = c
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
http://oj.acm.zstu.edu.cn/JudgeOnline/problem.php?cid=4034&pid=0
C++版本一
#include<stdio.h> #include<math.h> #include<algorithm> #include<string.h> using namespace std;int main(){int i,c,a,b;while(~scanf("%d",&c)){b=1;a=1;long long TS=b*b*b-a*a*a;int flag=0;while(TS!=c){if(TS>c)a++;else b++;TS=b*b*b-a*a*a;if(TS>c&&b-a==1){flag=1;break;}}if(flag)printf("-1\n");else printf("%d %d\n",a,b);}return 0; }?
總結
以上是生活随笔為你收集整理的b^3 - a^3 = c的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 情人节的阻击
- 下一篇: 多边形面积(Area_Of_Polygo