码迷,mamicode.com
首页 >  
搜索关键字:divide two integers    ( 17573个结果
1148 Werewolf - Simple Version (20分)
Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game, player #1 ...
分类:其他好文   时间:2020-05-02 14:51:55    阅读次数:49
1807. 斐波纳契数列简单
1807. 斐波纳契数列简单 中文English Find the Nth number in Fibonacci sequence. A Fibonacci sequence is defined as follow: The first two numbers are 0 and 1. The  ...
分类:其他好文   时间:2020-05-02 11:35:04    阅读次数:61
LeetCode 21. 合并两个有序链表
地址 https://leetcode-cn.com/problems/merge-two-sorted-lists/ 目描述将两个升序链表合并为一个新的升序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。 样例示例: 输入:1->2->4, 1->3->4输出:1->1->2->3-> ...
分类:其他好文   时间:2020-05-01 14:49:16    阅读次数:56
AtCoder Beginner Contest 164E - Two Currencies (二维最短路)
https://atcoder.jp/contests/abc164/tasks/abc164_e 题意大概是有n个城市,m条无向边,初始状态下,位于1号城市,且初始有s个银币。从u点到v点需要花费a银币、b时间。在每个点可以花d时间去兑换c个银币,求从起点1到各个点需要的最短时间。 思路:很显然这 ...
分类:其他好文   时间:2020-05-01 14:35:13    阅读次数:83
归并排序 递归实现
import java.util.Arrays;/** * 归并排序(MERGE-SORT)是建立在归并操作上的一种有效的排序算法,该算法是采用分治法(Divide and Conquer)的一个非常典型的应用。 * 将已有序的子序列合并,得到完全有序的序列;即先使每个子序列有序,再使子序列段间有序 ...
分类:编程语言   时间:2020-05-01 12:52:14    阅读次数:61
C. Two Arrays(思维DP或组合数学)
$首先很容易想到一个O(n^4m)的DP$ $设dp\ [i]\ [j]\ [q]\ 为长度i,a数组以j结尾,b数组以q结尾(q =j)$ ...
分类:其他好文   时间:2020-05-01 12:42:11    阅读次数:61
刷题617. Merge Two Binary Trees
一、题目说明 题目617. Merge Two Binary Trees,合并两个二叉树。难度是Easy! 二、我的解答 这个题目,用递归解法非常简单,同二叉树的递归遍历。 性能如下: 三、优化措施 非递归算法就不写了。 ...
分类:其他好文   时间:2020-05-01 10:38:15    阅读次数:57
Atcoder Beginner Contest 164 E Two Currencies(拆点+最短路)
"题目链接" 题意:有 $n$ 个城市,它们由 $m$ 条双向道路连接,保证它们能够彼此到达。第 $i$ 条道路连接 $u_i,v_i$,需要花费 $x_i$ 个银币,耗费 $t_i$ 秒的时间。每个城市处都有兑换银币处,第 $i$ 个城市中你可以用 $1$ 个金币兑换 $c_i$ 个银币,可以兑换 ...
分类:其他好文   时间:2020-04-30 21:04:21    阅读次数:104
1078 Hashing
The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. ...
分类:其他好文   时间:2020-04-30 15:15:38    阅读次数:44
[LeetCode] 371. Sum of Two Integers
两整数之和。题意是不用加减法做到对两个整数求和。思路是位运算,但是非常难想,需要复习。我是参考了这个帖子才想通了的。 ab低位进位 0 0 0 0 1 0 1 0 0 1 1 0 1 1 0 1 首先注意到,任意两个数字a和b相加的时候,他们的低位和高位的结果是什么?如上图所示,你会发现一个规律,低 ...
分类:其他好文   时间:2020-04-30 13:14:31    阅读次数:53
17573条   上一页 1 ... 39 40 41 42 43 ... 1758 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!