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的更多相关文章

  1. poj 1543 Perfect Cubes(注意剪枝)

    Perfect Cubes Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14901   Accepted: 7804 De ...

  2. OpenJudge 2810(1543) 完美立方 / Poj 1543 Perfect Cubes

    1.链接地址: http://bailian.openjudge.cn/practice/2810/ http://bailian.openjudge.cn/practice/1543/ http:/ ...

  3. POJ 1543 Perfect Cubes

    Perfect Cubes Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12595   Accepted: 6707 De ...

  4. poj 1543 Perfect Cubes (暴搜)

    Perfect Cubes Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 15302   Accepted: 7936 De ...

  5. HDOJ 1334 Perfect Cubes(暴力)

    Problem Description For hundreds of years Fermat's Last Theorem, which stated simply that for n > ...

  6. ZOJ Problem Set - 1331 Perfect Cubes 判断一个double是否为整数

    zju对时间要求比较高,这就要求我们不能简单地暴力求解(三个循环搞定),就要换个思路:因为在循环时,已知a,确定b,c,d,在外重两层循环中已经给定了b和c,我们就不用遍历d,我们可以利用d^3=a^ ...

  7. 【题解】「SP867」 CUBES - Perfect Cubes

    这道题明显是一道暴力. 暴力枚举每一个 \(a, b, c, d\) 所以我就写了一个暴力.每个 \(a, b, c, d\) 都从 \(1\) 枚举到 \(100\) #include<ios ...

  8. Zerojudge解题经验交流

    题号:a001: 哈囉 背景知识:输出语句,while not eof 题号:a002: 簡易加法 背景知识:输出语句,while not eof,加法运算 题号:a003: 兩光法師占卜術 背景知识 ...

  9. POJ题目细究

    acm之pku题目分类 对ACM有兴趣的同学们可以看看 DP:  1011   NTA                 简单题  1013   Great Equipment     简单题  102 ...

  10. HOJ题目分类

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

随机推荐

  1. 2351: [BeiJing2011]Matrix( hash )

    hash一下, 把原矩阵所有A*B的子矩阵的hash值存在set里面, 然后对于每个询问就求出hash值, 在set中查找. ------------------------------------- ...

  2. WCF跟踪分析 使用(SvcTraceViewer)

    1.首先在WCF服务端配置文件中配置两处,用于记录WCF调用记录! A:<system.serviceModel>目录下: <diagnostics>      <mes ...

  3. 在Outlook中设置QQ邮箱

    原本以为在Outlook中设置QQ邮箱没多大难度,但我错了,估计错了腾讯的麻烦程度,故记录下来. ----- 打开Outlook 2013(Outlook 2010也差不多),若是第一次打开会提示你设 ...

  4. python学习之day9

    队列queue 队列是线程安全的,它保证多线程间的数据交互的一致性. 先进先出队列Queue import queue q = queue.Queue(maxsize=3) #maxsize为队列最大 ...

  5. NAS简介

    转自IBM资料库:https://community.emc.com/docs/DOC-15977 在20世纪80年代初,英国纽卡斯尔大学布赖恩.兰德尔教授 ( Brian Randell)和同事通过 ...

  6. poj 1905 Expanding Rods 二分

    /** 题解晚上写 **/ #include <iostream> #include <math.h> #include <algorithm> #include ...

  7. [转]lftp的致命错误:证书验证:不信任

    原文:http://rajaseelan.com/2011/12/18/lftp-fatal-error-certificate-verification-not-trusted/如果您使用lftp的 ...

  8. java学习之生产者和消费者案例

    package com.gh.thread; /** * 生产者和消费者案例 * wait和sleep的区别 * wait不让出监视器锁,sleep让出监视器的锁 * @author ganhang ...

  9. ImageMagick 拼图及切图方法

    ImageMagick 拼图方法1. 拼图montage *.jpg  -tile 22x2  -geometry 64x256+0+0 10-.jpg将目录里的jpg文件按顺序拼成x轴22块,y轴2 ...

  10. IPv6-only 的兼容性解决方案

    前几天Apple宣布 6月1日后所有应用必须支持IPv6-only网络 今天抽空看了下这方面的知识 首先解释下IPv6的是什么? 维基百科的定义如下:IPv6是Internet Protocol ve ...