Given a positive integer a, find the smallest positive integer b whose multiplication of each digit equals to a. If there is no answer or the answer i ...
分类:
其他好文 时间:
2017-06-18 14:20:38
阅读次数:
193
题目:Optimal Array Multiplication Sequence 题目大意:给出N个矩阵相乘。求这些矩阵相乘乘法次数最少的顺序。 解题思路:矩阵相乘不满足交换率但满足结合率。dp【i】【j】 代表第1个矩阵到第j个矩阵之间的最少的乘法次数,转移状态方程:dp【i】【j】 = Min( ...
分类:
其他好文 时间:
2017-06-04 19:51:03
阅读次数:
155
题意:求两个n x n的矩阵相乘后模3的结果,n <= 800。 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4920 ——>>呀呀。。 1、3层计算的for进行缓存优化,依据CPU的L1级缓存的实现原理,降低缓存的变更。假设每次都计算完一个单元格的 ...
分类:
其他好文 时间:
2017-05-29 16:33:41
阅读次数:
118
If he would take the cards in the opposite order, i.e. 50, then 20, then 1, the score would be Input The first line of the input contains the number o ...
分类:
其他好文 时间:
2017-05-28 09:53:03
阅读次数:
197
Divide two integers without using multiplication, division and mod operator. 思路:1.先将被除数和除数转化为long的非负数,注意一定要为long。由于Integer.MIN_VALUE的绝对值超出了Integer的范围。 ...
分类:
其他好文 时间:
2017-05-19 12:56:44
阅读次数:
153
传送门:http://bailian.openjudge.cn/practice/2505/ 【题解】 我们找找规律: 1~9显然是Stan wins. 10~18是Ollie wins. 19~162是Stan wins... 发现分界线是18^? 判判就行了。 # include <stdio. ...
分类:
其他好文 时间:
2017-05-18 18:49:54
阅读次数:
155
题目地址:HDU 4920 对这个题简直无语到极点。。。竟然O(n^3)的复杂度能过。。。。方法有三。。 1:进行输入优化和输出优化。。(前提是你的输入优化不能太搓。。。) 2:利用缓存优化。。详情请看该论文。大体就是将后两个for循环换过来,让坐标改变的频率降下来。 3:叉姐题解中说的正规方法。。 ...
分类:
其他好文 时间:
2017-05-14 12:28:13
阅读次数:
203
题目链接:点击打开链 题意: 给定一个数组,每次能够选择内部的一个数 i 消除,获得的价值就是 a[i-1] * a[i] * a[i+1] 问最小价值 思路: dp[l,r] = min( dp[l, i] + dp[i, r] + a[l] * a[i] * a[r]); #include <c ...
分类:
其他好文 时间:
2017-05-14 10:49:49
阅读次数:
107
做CC时经常要用正则表达式过滤数据,当时洗的数据比较复杂,规则比较多。这次做leetcode,复习一下Java的正则匹配。Leetcode 537. Complex Number Multiplication 从表示复数的字符串里把实部和虚部取出来。 http://blog.csdn.net/yin ...
分类:
编程语言 时间:
2017-04-30 15:10:25
阅读次数:
226
二分!!! AC代码例如以下: #include<iostream> #include<cstring> #include<cstdio> #define ll long long using namespace std; ll n,m,k; ll work(ll a) { ll i,j; ll a ...
分类:
其他好文 时间:
2017-04-29 12:00:27
阅读次数:
153