题意:在这个20×20方阵中,四个在同一方向(从下至上.从上至下.从右至左.从左至右或者对角线)上相邻的数的乘积最大是多少? 思路:暴力去枚举以 ( x , y ) 为中心拓展的四个方向 /************************************************************************* > File Name: euler011.c > Author: WArobot > Blog: http://www.cnblogs.com/WAro…
Problem 11 In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 0849 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 0081 49 31 73 55 79 14 29 93 71 40 67…
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? 譯文: 觀察著1000個數字,通過…
先粘实现代码,以后需要再慢慢补充思路 s = ''' 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 6689664895044524452…
这个比前面的要复杂点,但找对了规律,还是可以的. 我逻辑思维不强,只好画图来数数列的下标了. 分四次计算,存入最大值. 左右一次,上下一次,左斜一次,右斜一次. In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 0849 49 99 40 17 81 18 57 60…
https://github.com/Premiumlab/Python-for-Algorithms--Data-Structures--and-Interviews/blob/master/Mock%20Interviews/Ride%20Share%20Start-Up%20Company/Ride%20Share%20Company%20-%20Interview%20Questions%20-%20SOLUTIONS/On-Site%20Question%201%20-%20SOLUT…
Problem 11 # Problem_11.py """ In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 4…
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. 3位数的话,就从999开始,为了减少遍历次数,就先从999-900,如果没有条件满足…
In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 0…
这个我开始理解错了,算错了. 我以为是求连续5个数的最大值,结果,是连接5个数相乘的最大值. 英语不好,容易吃亏啊. Find the greatest product of five consecutive digits in the 1000-digit number. 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891…
The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? 欧拉题里很多是关于求质数,求质数的方法很多,我推荐的是筛选法,效率高,也很好理解.百度一下就有详细说明. def primeslist(max): a = [True]*(max+1) # 创建一个list,下标的位置就代表数字 a[0],a[1]=False,False # 0…
Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2: Input: [1,2,3,4] Output: 24 Note: The length of the given array will be in range [3,104] and all elemen…
题目要求是: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319…
Problem - D - Codeforces Example input 5 4 1 2 -1 2 3 1 1 -2 5 2 0 -2 2 -1 3 -2 -1 -1 3 -1 -2 -2 output 0 2 3 0 2 0 0 1 1 0 最近赛中敲不出代码, 赛后倒是镇静了, 我也醉了 简述下思路及变量意义: 这里采取从前到尾遍历,由于数据范围不能完全连乘2e5个的2, 所以我们采取计数方法, num表示绝对值为2的个数, sign表示当前是正负数, min是从上一个0到现在连乘绝对值…
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a containe…
题目大意: 给定一颗黑白树.允许删除一个白点.最大化删点后无法与删点前距自己最远的黑点连通的黑点个数.并求出方案数. 题解: 这道题很棒棒啊. 一开始想了一个做法,要用LCT去搞,特别麻烦而且还是\(O(nlogn)\)的 % 了vfk的题解才知道这道题居然是\(O(n)\)的... 我们有一个结论:一个点到其最远点的路径一定经过树的直径的重心. 因为所有直径的重心一定相同,所以我们知道重心最多有两个,并且一定连续. 所以我们将重心提至根,以新的根重新建树.那么我们现在就可以发现我们要切断的所有…
题意:寻找这 1000 个数中相邻 13 个数相乘积最大的值 思路:首先想到的是暴力,但是还可以利用之前记录过的数值,什么意思呢?即在计算 2 - 14 后,再计算 3 - 15 时完全可以利用之前计算 2-14的值再除以 2 乘上 15 ,但是因为其中有 0 的存在需要改造一下,记录下之前出现的 0 的个数,当这连续13个数有 0 存在的时候,结果自然是 0 直接忽略,当没 0 的时候更新一下 maxN 即可. /****************************************…
题目大意:给你\(A\)个a,\(B\)个b,\(C\)个c,要你构造一个字符串,使它的最小循环表示法最大.求这个表示法.解题思路:不知道怎么证,但把a.b.c当做单独的字符串扔进容器,每次把字典序最小的和字典序最大的两个字符串合并就是答案.容器用multiset即可. C++ Code: #include<cstdio> #include<set> #include<string> using namespace std; multiset<string>…
OS: Oracle Linux Server release 5.7 DB: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production 1.以oracle用户登录启动dbca [root@rac ~]# su - oracle [oracle@rac ~]$ dbca 会逐一删除所有节点的database 2.用oracle用户登录并在cd $ORACLE_HOME/deinstall目录下执行de…
本题来自 Project Euler 第11题:https://projecteuler.net/problem=11 # Project Euler: Problem 10: Largest product in a grid # In the 20×20 grid below, four numbers along a diagonal line have been marked in red. # The product of these numbers is 26 × 63 × 78 ×…
PE 中文翻译 最喜欢做这种很有意思的数学题了虽然数学很垃圾 但是这个网站的提交方式好鬼畜啊qwq 1.Multiples of 3 and 5 直接枚举 2.Even Fibonacci numbers 直接枚举 3.Largest prime factor $\sqrt(n)$枚举 #include<cstdio> #include<vector> #include<set> #include<algorithm> #define sit #define…
本题来自 Project Euler 第8题:https://projecteuler.net/problem=8 # Project Euler: Problem 8: Largest product in a series # The four adjacent digits in the 1000-digit number # that have the greatest product are 9 × 9 × 8 × 9 = 5832. # Find the thirteen adjac…
先做个说明,里面所有的题都是我自己写的解题报告,由于我的能力有限,是个刚学java的小白,有很多不足的地方,还望各位大佬不奢赐教,谢谢! Largest product in a grid In the 20×20 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08           …
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/1371281760.html 原创:[欧拉计划4]Largest palindrome product 摘要:找出两个3位数乘积得到的最大回文数 作者:MilkCu 题目描述 Problem 4  Largest palindrome product A palindromic number reads the same both way…
Problem 28 https://projecteuler.net/problem=28 Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows: 从1开始,顺时针旋螺转,可得一个5*5的螺旋如下: 21 22 23 24 2520  7  8  9 1019  6  1  2 1118  5  4  3 1217 16 1…
Problem 21 https://projecteuler.net/problem=21 Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are c…
Problem 42 https://projecteuler.net/problem=42 The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... 三角数可由上述公式得出. By converting each letter in a wor…
环境:两节点RAC(RHEL 6.4 + GI 11.2.0.4 + Oracle 11.2.0.4) 需求:安装最新PSU补丁11.2.0.4.7 1.下载补丁和最新OPatch 2.检查数据库当前OPatch版本 3.更新OPatch 4.解压补丁文件 5.检查补丁之间有无冲突 6.停止数据库和本地crs服务 7.更新补丁 8.登录数据库执行升级字典操作 9.验证补丁更新结果 Reference 1. 下载补丁和最新OPatch MOS 补丁程序和更新程序搜索到最新的PSU:截至目前最新是1…
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest product = 6. 这个求最大子数组乘积问题是由最大子数组之和问题演变而来,但是却比求最大子数组之和要复…
Find the contiguous subarray within an array (containing at least one number) which has the largest product. For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest product = 6. Since two negative numbers may multiply an…