Joking with Fermat's Last Theorem UVA
来源:互联网 发布:天刀淘宝刷白发多少钱 编辑:程序博客网 时间:2024/05/22 04:28
题目链接:点击打开链接
题意:在 x 和 y之间有多少对a ,b ,c 使a^3+b^3==c;
题解:
尽管题中给出x ,y 的范围是1~10^8,但实际上优化一下,c+10+3的1/3次方就是x,y的上限,然后循环暴就行了;
#include<iostream>#include<algorithm>#include<cmath>#include<cstdio>#include<cstring>#include<iomanip>using namespace std;int main(){ int a,b; int kase=0; while(cin>>a>>b){ int num=0; double k=pow(b*10+3,1.0/3); for(int i=a;i<int(k)+1;i++){ for(int j=a;j<int(k)+1;j++){ int temp=i*i*i+j*j*j; if(temp>b*10+3||temp<a) continue; if(temp%10==3) num++; } } cout<<"Case "<<++kase<<": "<<num<<endl; } return 0;}
阅读全文
0 0
- Joking with Fermat's Last Theorem UVA
- uva 12665 - Joking with Fermat's Last Theorem
- uva 12665 - Joking with Fermat's Last Theorem 题解
- Fermat’s Chirstmas Theorem
- Fermat’s Chirstmas Theorem
- Fermat’s Chirstmas Theorem
- Fermat’s Chirstmas Theorem
- poj3511--Fermat's Christmas Theorem
- SGU_511_Fermat's Last Theorem
- Test Prime Using Fermat's Little Theorem
- Fermat's little theorem(费马小定理)
- Fermat’s Chirstmas Theorem(素数筛)
- POj 3511 Fermat’s Chirstmas Theorem
- 素数判断----E -Fermat’s Chirstmas Theorem
- SDUT Fermat’s Chirstmas Theorem(素数筛)
- POJ 3511 Fermat's Christmas Theorem 可能会
- Morley's Theorem UVA
- Fermat’s Chirstmas Theorem——素数筛
- hdu2795 Billboard 线段树应用
- CentOS上安装LAMP之Apache环境及安装过程报错解决方案(纯净系统环境)
- CaoHaha's staff(hdoj6154)
- 浏览器兼容问题
- 二十三种设计模式之原型模式
- Joking with Fermat's Last Theorem UVA
- python学习(1)
- SpringBoot快速入门
- 从HTML表格删除行
- 乘法逆元数论篇
- Deeplearning.ai学习笔记之第一课第一周
- Linux下创建svn以及相关操作
- linux下自创网络编程聊天室(4)改进两点
- 数论--几何--笛卡尔原理