poj 1543 Perfect Cubes (暴搜)
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 15302 | Accepted: 7936 |
Description
Input
Output
Sample Input
24
Sample Output
Cube = 6, Triple = (3,4,5)
Cube = 12, Triple = (6,8,10)
Cube = 18, Triple = (2,12,16)
Cube = 18, Triple = (9,12,15)
Cube = 19, Triple = (3,10,18)
Cube = 20, Triple = (7,14,17)
Cube = 24, Triple = (12,16,20)
Java AC 代码
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i = 2; i <= n; i++)
for(int a = 2; a < i; a++)
for(int b = a; b < i; b++)
for(int c = b; c < i; c++) {
if(i*i*i == a*a*a + b*b*b + c*c*c) {
System.out.println("Cube = " + i +", Triple = (" + a + "," + b + "," + c +")");
}
}
}
}
poj 1543 Perfect Cubes (暴搜)的更多相关文章
- 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: 14901 Accepted: 7804 De ...
- POJ 1543 Perfect Cubes
Perfect Cubes Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12595 Accepted: 6707 De ...
- POJ 1167 The Buses 暴搜+剪枝
思路: 先把能选的路线都预处理出来 按照能停的车的多少排个序 (剪枝1) 搜搜搜 如果当前剩的车÷当前能停车的多少+deep>=ans剪掉 (剪枝2) //By SiriusRen #inclu ...
- POJ 1166 The Clocks (暴搜)
发现对这样的模拟题根本没啥思路了,本来准备用bfs的.可是结果超时了,这是參考别的人代码写的: #include <stdio.h> #include <iostream> # ...
- poj 3080 Blue Jeans(水题 暴搜)
题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include< ...
- POJ 1945 暴搜+打表 (Or 暴搜+判重)
思路: 呃呃 暴搜+打表 暴搜的程序::稳稳的TLE+MLE (但是我们可以用来打表) 然后我们就可以打表过了 hiahiahia 可以证明最小的那个数不会超过200(怎么证明的我也不知道),然后就直 ...
- [POJ 1204]Word Puzzles(Trie树暴搜&AC自己主动机)
Description Word puzzles are usually simple and very entertaining for all ages. They are so entertai ...
- POJ 1414 暴搜
题意比较复杂 (但是很好理解) 大概意思是给你等边三角形(详见题目中的图). 最后一行有n个数,下一次要填的数是c. 里面预先已经填好了数字.(0为未填) 得分的标准是这个分数的连通块周围没有空的地方 ...
随机推荐
- elk5.0 版本遇到的安装问题
问题1:max_map_count不够大 max virtual memory areas vm.max_map_count [65536] likely too low, increase to a ...
- VS 2017 VC++项目出现 LNK1104 无法打开文件"libcmtd.lib" 的解决方法
今天用VS 2017编译一个以前的VC++动态库项目,出现了一个链接器问题: LNK1104 无法打开文件"libcmtd.lib" . 操作系统版本为:Windows 10 18 ...
- 自定义view实现画个闪烁的心
package com.loaderman.lovecircledemo; import android.support.v7.app.AppCompatActivity; import androi ...
- SweetAlert(弹出层插件)
怀着非常.非常恼火的心情写下这个博文.我深深怀疑有一些人只会瞎粘贴复制别人的博文,自己试都不试就发布到网上,左右看的人想法,就此深通恶绝!! 废话不多说. SweetAlert是一个简洁好用的自制Al ...
- [Cinder] 存储 Qos
目录 文章目录 目录 前言 操作步骤 参考文章 前言 Cinder 支持 front-end 和 back-end 两种类型的存储 QoS,前者由 Hypervisor 端实现(e.g. 通过 Lib ...
- Linux_系统破坏性修复实验
目录 目录 修改系统用户密码 grub修复 系统修复 最后 修改系统用户密码 随便介绍一个修改Linux系统用户密码的方法. 步骤: 开机读秒时按任意键 进入grub列表项配置按e 选择系统kerne ...
- 阶段3 2.Spring_02.程序间耦合_3 程序的耦合和解耦的思路分析1
编译时没有对应需要的jar包就报错.这特性就理解为程序的耦合 这种方式,它不是个错误而是个异常.编译的时候没有问题.运行时才会报错. 把注释的代码放开 程序可以正常运行 解决类之前依赖的思路 一个依赖 ...
- Flutter异步Future
一.认识Future 1.创建Future void testFuture(){ Future future = new Future(() => null); future.then((_){ ...
- IIS部署网站 HTTP 错误 500.21 - Internal Server Error
HTTP 错误 500.21 - Internal Server Error处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedPipel ...
- js里面for循环的++i与i++
首先我们应该都知道++i与i++的区别是: ++i 是先执行 i=i+1 再使用 i 的值,而 i++ 是先使用 i 的值再执行 i=i+1: 然后我们也知道for循环的执行顺序如下: for(A;B ...