费马大定理:当n>2时,不定方程an+bn=cn没有正整数解。比如a3+b3=c3没有正整数解。为了活跃气氛,我们不妨来个搞笑版:把方程改成a3+b3=c3,这样就有解了,比如a=4, b=9, c=79时43+93=793。

输入两个整数x, y, 求满足x<=a,b,c<=y的整数解的个数。

Input

输入最多包含10组数据。每组数据包含两个整数x, y(1<=x,y<=108)。

Output

对于每组数据,输出解的个数。

Sample Input

1 10

1 20

123 456789

Sample Output

Case 1: 0

Case 2: 2

Case 3: 16

//感觉自己最这一类题做的神经有点错乱了,总以为会超时,然后就不敢做。。
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<math.h>
#include<cstdio>
#include<sstream>
#include<numeric>//STL数值算法头文件
#include<stdlib.h>
#include <ctype.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<functional>//模板类头文件
using namespace std; typedef long long ll;
const int maxn=1100;
const int INF=0x3f3f3f3f; int main()
{
int x,y,ans;
int cas=1;
while(scanf("%d %d",&x,&y)!=EOF)
{
ans=0;
for(int a=x; a<=y; a++)
{
for(int b=x; b<=y; b++)
{
ll s=a*a*a+b*b*b;
if(s/10>y)break;
if(s%10==3)
{
if((s/10)>=x&&(s/10)<=y)
ans++;
}
}
if((a*a*a+x*x*x)/10>y)
break;
}
printf("Case %d: %d\n",cas++,ans);
}
}

CSU - 1337 (搞笑版费马大定理 )的更多相关文章

  1. CSU 1337 搞笑版费马大定理【优化枚举】

    费马大定理:当n>2时,不定方程an+bn=cn没有正整数解.比如a3+b3=c3没有正整数解.为了活跃气氛,我们不妨来个搞笑版:把方程改成a3+b3=c3,这样就有解了,比如a=4, b=9, ...

  2. CSU 1337 搞笑版费马大定理(2013湖南省程序设计竞赛J题)

    题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1337 解题报告:虽然x和y的范围都是10^8,但是如果a 是大于1000的话,那么a^3 ...

  3. csuoj 1337: 搞笑版费马大定理

    http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1337 1337: 搞笑版费马大定理 Time Limit: 1 Sec  Memory Limit ...

  4. J - 搞笑版费马大定理

    J - 搞笑版费马大定理 Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu Submit  ...

  5. CSU 1337(费马大定理)

      CSU 1337 Time Limit:1000MS     Memory Limit:131072KB     64bit IO Format:%lld & %llu   Descrip ...

  6. Nginx报504 gateway timeout错误的解决方法(小丑搞笑版。。。)

    一.今天登录我的网站,突然发现报了下面的一个错误: 我的第一反应是:超时了应该是Nginx代理没有设置超时时间,默认的超时时间估计太小了,然后就按照正常的方式用Xshell连接服务器,应该是网络或者是 ...

  7. python 利用tkinter模块设计出window窗口(搞笑版)

    代码如下 from tkinter import * import tkinter from tkinter import messagebox #定义了一个函数,当关闭window窗口时将会弹出一个 ...

  8. Java设计模式23种(搞笑版) (转)

        昨天做了一下支付宝的笔试题目被打击了,大量的逻辑推理和数学规律运算题目,其中还有问道Java设计模式的题目,一点都不知道,今天看到一份不错的介绍,非常好理解,作者是谁我没有办法考证,但是所有权 ...

  9. 集训队日常训练20181117 DIV2

    大佬们一顿操作猛如虎,拼命AC强啊 4262: 区间异或  Time Limit(Common/Java):1000MS/3000MS     Memory Limit:65536KByteTotal ...

随机推荐

  1. u3d局域网游戏网络(c# socket select 模型)——续

    原文:http://www.cnblogs.com/saucerman/p/5555793.html 因为项目要加语音.语音数据都非常大.所以顺带就把之前写的网络模块一起测试了. 然后发现了一些bug ...

  2. bzoj 1776: [Usaco2010 Hol]cowpol 奶牛政坛——树的直径

    农夫约翰的奶牛住在N (2 <= N <= 200,000)片不同的草地上,标号为1到N.恰好有N-1条单位长度的双向道路,用各种各样的方法连接这些草地.而且从每片草地出发都可以抵达其他所 ...

  3. Intersecting Lines (计算几何基础+判断两直线的位置关系)

    题目链接:http://poj.org/problem?id=1269 题面: Description We all know that a pair of distinct points on a ...

  4. Warning: File upload error - unable to create a temporary file in Unknown on line 0

    upload_tmp_dir 临时文件夹问题 上传文件提示 Warning: File upload error - unable to create a temporary file in Unkn ...

  5. .net WebAPI返回xml、json格式

    WebAPI返回xml.json格式简单示例 using System.Net.Http.Formatting; public class TestController : ApiController ...

  6. Ubuntu 修改IP地址

    Ubuntu 修改IP地址1.ubuntu系统修改IP地址:sudo vim /etc/network/interfacesauto eth0iface eth0 inet staticaddress ...

  7. bisai.py

    比赛专用py #!/usr/etc/env python #encoding:utf-8 #by i3ekr #token import re,os,requests res = "(fla ...

  8. 禁用 Cortana 的解决办法

    1. GPedit.msc 2. 然后在本地组策略编辑器中,点击“用户配置”中的“管理模版”,接着双击右侧的“Windows 组件”. 3. 下拉滚动条,并找到“文件资源管理器”,双击进入. 找到“在 ...

  9. 使用Redirector插件解决googleapis公共库加载的问题【转】

    转自:http://www.cnblogs.com/kari/p/5860371.html 最近访问一些面向国外的网站总是会出现ajax.googleaips.com无法加载的情况.以下为加载stac ...

  10. 64_g1

    GAPDoc-1.5.1-12.fc26.noarch.rpm 13-Feb-2017 22:37 1082286 GAPDoc-latex-1.5.1-12.fc26.noarch.rpm 13-F ...