hdu1334-Perfect Cubes
http://acm.hdu.edu.cn/showproblem.php?pid=1334
题意;求200以内所有满足a^ 3 == b^ 3 + c ^ 3 +d ^ 3
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<iomanip> using namespace std; int main()
{
int a , b , c , d ;
for( int a = 2 ; a <= 200 ; ++a )
for( int b = 2 ; b <= a; ++ b )
for( int c = b + 1 ; c <= a ; ++c )
for( int d = c + 1 ; d <= a ;++d )
if( a * a * a == b * b * b + c * c * c + d * d *d )
{
printf( "Cube = %d, Triple = (%d,%d,%d)\n" , a , b , c , d ) ;
}
return 0 ;
}
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<iomanip> using namespace std; int main()
{
int a , b , c , d ;
int num[ 201 ] ;
for( int i = 1 ; i <= 200 ; ++i )
{
num[ i ] = i * i * i ;
}
for( a = 6 ; a <= 200 ; ++a )
{
for( b = 2 ; b <= a ; ++b )
{
int x = num[ a ] - num[ b ] ;
for( c = b + 1 ; c <= a ; ++c)
{
int y = x - num[ c ];
for( d = c + 1 ; d <= a ; ++d )
{ if( num[ d ] == y )
printf( "Cube = %d, Triple = (%d,%d,%d)\n" , a , b , c , d ) ;
}
}
}
}
return 0 ;
}
hdu1334-Perfect Cubes的更多相关文章
- poj 1543 Perfect Cubes(注意剪枝)
Perfect Cubes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14901 Accepted: 7804 De ...
- OpenJudge 2810(1543) 完美立方 / Poj 1543 Perfect Cubes
1.链接地址: http://bailian.openjudge.cn/practice/2810/ http://bailian.openjudge.cn/practice/1543/ http:/ ...
- POJ 1543 Perfect Cubes
Perfect Cubes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12595 Accepted: 6707 De ...
- poj 1543 Perfect Cubes (暴搜)
Perfect Cubes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 15302 Accepted: 7936 De ...
- HDOJ 1334 Perfect Cubes(暴力)
Problem Description For hundreds of years Fermat's Last Theorem, which stated simply that for n > ...
- ZOJ Problem Set - 1331 Perfect Cubes 判断一个double是否为整数
zju对时间要求比较高,这就要求我们不能简单地暴力求解(三个循环搞定),就要换个思路:因为在循环时,已知a,确定b,c,d,在外重两层循环中已经给定了b和c,我们就不用遍历d,我们可以利用d^3=a^ ...
- 【题解】「SP867」 CUBES - Perfect Cubes
这道题明显是一道暴力. 暴力枚举每一个 \(a, b, c, d\) 所以我就写了一个暴力.每个 \(a, b, c, d\) 都从 \(1\) 枚举到 \(100\) #include<ios ...
- Zerojudge解题经验交流
题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识 ...
- POJ题目细究
acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP: 1011 NTA 简单题 1013 Great Equipment 简单题 102 ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
随机推荐
- python命令行解析工具argparse模块【3】
上一节,我们讲解了ArgumentParser对象,这一节我们将学习这个对象的add_argument()方法. add_argument()方法的定义了如何解析一个命令行参数,每个参 ...
- Linux常用解压文件
tar.gz tar -zxvf filename.tar.gz tar.bz2 tar -vxjf filename.tar.bz2
- C陷阱与缺陷(四)
第四章 连接 4.1 什么是连接器 C语言中的一个重要思想就是分别编译,即若干个源程序可以在不同的时候单独进行编译,然后在恰当的时候整合在一起.典型的连接器把由编译器或汇编器生成的若干个目标模块,整合 ...
- Windows Phone 8初学者开发—第3部分:编写第一个Windows Phone 8应用程序
原文 Windows Phone 8初学者开发—第3部分:编写第一个Windows Phone 8应用程序 原文地址: http://channel9.msdn.com/Series/Windows- ...
- BZOJ 1385: [Baltic2000]Division expression
题目 1385: [Baltic2000]Division expression Time Limit: 5 Sec Memory Limit: 64 MB Description 除法表达式有如下 ...
- BZOJ 1652: [Usaco2006 Feb]Treats for the Cows
题目 1652: [Usaco2006 Feb]Treats for the Cows Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 234 Solve ...
- IIS express 7.5 配置和多网站执行
iis express7.5 支持xp 以上的操作系统,能够解决xp.iis的问题. 首先先下载安装iisexpress7.5地址是id=1038">点击打开链接下载完毕点击安装就可以 ...
- stm32之595(spi芯片)
595是一款串转并的芯片: (三极管的功能) /*Include---------------------------*/ #include"stm32f10x_lib.h" / ...
- RBAC - 基于角色的权限控制
ThinkPHP中关于RBAC使用详解 自己的源码下载:百度网盘,thinkPHP文件夹下,RBAC文件夹. 重要的是,权限信息的写入函数等.在源码中能找到,Modules/Amin/Common/c ...
- ios常见加密解密方法
在其他平台中经常会计算MD5值,在iOS平台中也提供了该方法,首先需要导入头文件 #import <CommonCrypto/CommonDigest.h> 方法CC_MD5可以获取MD5 ...