ProjectEuler 004题
1 #include<iostream>
2 using namespace std;
3
4 int main() {
5 bool isPalindromic (int num);
6 int res = 0;
7
8 for(int i = 100; i < 1000 ; i++)
9 for(int j = 100; j < 1000; j++) {
10 if( isPalindromic(i*j) && i*j > res)
11 res = i*j;
12 }
13 cout << res;
14 system("pause");
15 return 0;
16 }
17 //判断回文
18 bool isPalindromic(int num) {
19 int rev_num = 0;
20 int m = num;//商
21 while(m != 0) {
22 rev_num = rev_num * 10 + m%10;
23 m = m/10;
24 }
25 if( rev_num == num)
26 return true;
27 else
28 return false;
29 }
ProjectEuler 004题的更多相关文章
- ProjectEuler 做题记录
退役选手打发时间的PE计划 挂在这里主要是dalao们看到有什么想交流的东西可以私聊哦(站内信或邮箱吧)~~当然现在高三也不怎么能上网. 2017/8/11 595 :第一题QAQ 2017/8/1 ...
- ProjectEuler 005题
题目: 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any ...
- ProjectEuler 009题
题目: A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = c2 For exam ...
- ProjectEuler 008题
题目: The four adjacent digits in the 1000-digit number that have the greatest product are 9 9 8 9 = 5 ...
- ProjectEuler 007题
题目:By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is ...
- ProjectEuler 006题
题目: The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square ...
- ProjectEuler 003题
1 //题目:The prime factors of 13195 are 5, 7, 13 and 29. 2 //What is the largest prime factor of the n ...
- nim也玩一行流,nim版的list comprehension
nim 是一门风格类似python的静态编译型语言,官方网站:http://nim-lang.org 如果你想折腾nim的编辑环境,可以用sublime text3 +插件nimlime,notepa ...
- ProjectEuler && Rosecode && Mathmash做题记录
退役选手打发时间的PE计划 挂在这里主要是dalao们看到有什么想交流的东西可以私聊哦(站内信或邮箱吧) 2017/8/11 PE595 :第一题QAQ 2017/8/12 PE598 2017/ ...
随机推荐
- Scala学习——基础入门
基础语法 1)注意点 1)区分大小写 - Scala是大小写敏感的,这意味着标识Hello 和 hello在Scala中会有不同的含义. 2)类名 - 对于所有的类名的第一个字母要大写. 3)方法名 ...
- 算法leetcode_分治算法
一.基本概念 在计算机科学中,分治法是一种很重要的算法.字面上的解释是"分而治之",就是把一个复杂的问题分成两个或更多的相同或相似的子问题,再把子问题分成更小的子问题--直到最后子 ...
- 微信小程序云开发-云存储的应用-识别营业执照
一.准备工作 1.创建云函数identify 二.云函数identify中index.js代码 1 // 云函数入口文件 2 const cloud = require('wx-server-sdk' ...
- 01_Nginx下载安装
一.简介 Nginx 是由俄罗斯人 Igor Sysoev 设计开发的,开发工作从2002 年开始,第一次公开发布在 2004 年 10 月 4 日. 官方网站为:http://nginx.org/ ...
- PGSQL数据库里物化视图【materialized view】
1.普通视图 数据库中的视图(view)是从一张或多张数据库表查询导出的虚拟表,反映基础表中数据的变化,且本身不存储数据. 2.物化视图[materialized view] 2.1.概念: ...
- HCNA Routing&Switching之OSPF缺省路由发布
前文我们了解了OSPF的度量值,以及基础配置命令的总结,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15069632.html:今天我们来聊一聊在ospf里动 ...
- 深度强化学习中稀疏奖励问题Sparse Reward
Sparse Reward 推荐资料 <深度强化学习中稀疏奖励问题研究综述>1 李宏毅深度强化学习Sparse Reward4 强化学习算法在被引入深度神经网络后,对大量样本的需求更加 ...
- SpringBoot-表单验证-统一异常处理-自定义验证信息源
1. 简介 我们都知道前台的验证只是为了满足界面的友好性.客户体验性等等.但是如果仅靠前端进行数据合法性校验,是远远不够的.因为非法用户可能会直接从客户端获取到请求地址进行非法请求,所以后台的校验是必 ...
- 将MNIST手写数据集转换成图片保存到本地
# 加载图片 data = tf.keras.datasets.mnist (x_train, y_train), (x_test, y_test) = data.load_data() plt.im ...
- 遗传算法 TSP(Python代码)
该代码是本人根据B站up主侯昶曦的代码所修改的. 原代码github地址:https://github.com/Houchangxi/heuristic-algorithm/blob/master/T ...