algorithm
文章平均质量分 85
Ring_k
这个作者很懒,什么都没留下…
展开
-
uva-1587
Problem backgroundIvan works at a factory that produces heavy machinery. He has a simple job | he knocks up wooden boxes of different sizes to pack machinery for delivery to the customers. Each box is...原创 2018-02-17 16:04:57 · 402 阅读 · 0 评论 -
uva-1588
Problem BackgroundA research laboratory of a world-leading automobile company has received an order to create a special transmission mechanism, which allows for incredibly efficient kickdown — an oper...原创 2018-02-18 12:42:08 · 492 阅读 · 0 评论 -
uva-11809
Problem backgroundFloating-point numbers are represented differently in computers than integers. That is why a 32-bit floating-point number can represent values in the magnitude of while a 32-bit in...原创 2018-02-18 21:15:51 · 354 阅读 · 0 评论 -
Java解决排列组合问题——深度优先遍历
问题1: 假设袋子里有编号为1,2,...,m这m个球。现在每次从袋子中取一个球几下编号,放回袋中再取,取n次作为一组,枚举所有可能的情况。分析:每一次取都有m种可能的情况,因此一共有种情况。这里我们取m = 3, n = 4,则有种不同的情况。代码:import java.util.Stack;public class Test { static int cnt = 0; s...原创 2018-03-15 23:05:37 · 6300 阅读 · 2 评论 -
Java实现表达式计算(中缀表达式转化为后缀表达式/逆波兰式)
定义:中缀表达式:我们平时写的数学表达式一般为中缀表达式,如“”,直接拿中缀表达式直接让计算机计算表达式的结果并不能做到。后缀表达式:把中缀表达表达式“”转化“”这样的形式,就是后缀表达式。这种记法叫做后缀(postfix)或逆波兰(reverse Polish)记法。计算这个问题最容易的方法就是使用一个栈。转换方法:按次序读取中缀表达式的字符。读到一个操作数的时候,立即放入到输出中。读到操作符“...原创 2018-03-18 13:23:44 · 21909 阅读 · 11 评论 -
幂运算 C++(快速幂和大数运算)
1. 快速幂提高运算速度。传统幂时间复杂度为O(n),使用快速幂缩小为O(logn),其中n为指数。基本思想:base*=base 这里就是在算int poww(int a, int b){ // return a ^ b int ans = 1, base = a; while(b != 0){ if(b&1 != 0) ans *= base; ...原创 2018-06-07 22:07:00 · 13352 阅读 · 1 评论