HDOJ2009(预处理)
来源:互联网 发布:java与xml 第3版 pdf 编辑:程序博客网 时间:2024/06/17 22:43
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <math.h>
using namespace std;
int a[1001] = { 0 };
int b[3] = { 0 };
void sxh()
{
for (int i = 120; i < 999; i++)
{
int now = i;
int j = 0;
while (now)
{
b[j++] = now % 10;
now /= 10;
}
if (pow(b[0], 3) + pow(b[1], 3) + pow(b[2], 3) == i) a[i] = 1;
}
}
int main()
{
sxh();
int n, m;
while (cin >> n >> m)
{
int no = 0;
for (int i = n; i <= m; i++)
{
if (a[i] )
{
if (no) cout << " ";
cout << i;
no = 1;
}
}
if (!no) cout << "no";
cout << endl;
}
}
#include <cstring>
#include <string>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <math.h>
using namespace std;
int a[1001] = { 0 };
int b[3] = { 0 };
void sxh()
{
for (int i = 120; i < 999; i++)
{
int now = i;
int j = 0;
while (now)
{
b[j++] = now % 10;
now /= 10;
}
if (pow(b[0], 3) + pow(b[1], 3) + pow(b[2], 3) == i) a[i] = 1;
}
}
int main()
{
sxh();
int n, m;
while (cin >> n >> m)
{
int no = 0;
for (int i = n; i <= m; i++)
{
if (a[i] )
{
if (no) cout << " ";
cout << i;
no = 1;
}
}
if (!no) cout << "no";
cout << endl;
}
}
阅读全文
0 0
- HDOJ2009(预处理)
- HDOJ2009
- hdoj2009
- HDOJ2009
- hdoj2009解题报告
- hdoj2008/hdoj2009/hdoj2010/hdoj2011/hdoj2012
- Hdoj2009求数列的和
- HDOJ2009 求数列的和
- 预处理
- 预处理
- 预处理
- 预处理
- 预处理
- 预处理
- 预处理
- 预处理
- 预处理
- 预处理
- 第四周项目3
- 集成学习之Adaboost算法原理小结
- Scrapy爬虫笔记
- 2017 icpc 南宁赛区 F.Overlapping Rectangles(重叠矩形的最大面积+线段树模板)
- java 技术资料,jar包下载,工具下载等资源网站
- HDOJ2009(预处理)
- css background-image 自适应宽高
- Hive基础(3):表分类、视图、数据加载方式、数据的导出、本地模式
- 梯度提升树(GBDT)原理
- jquery.ajax 跨域请求webapi,设置headers
- 实战演练 test16 T2
- 模拟 飞(fly)
- JSP动作元素与指令元素
- javaScript实现快速排序