码迷,mamicode.com
首页 >  
搜索关键字:algorithm    ( 11758个结果)
[Algorithm] 234. Palindrome Linked List / Reverse linked list
Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true /** * Defi ...
分类:其他好文   时间:2020-01-23 09:28:20    阅读次数:63
I - Strength HDU - 6563
#include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<algorithm> #include<cstring> #include<string> #include<vector> #include ...
分类:其他好文   时间:2020-01-23 00:23:21    阅读次数:125
PAT 乙级真题 1014.科学计数法
PAT 乙级真题 1014.科学计数法 题目描述 科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式[+ ][1 9]"."[0 9]+E[+ ][0 9]+,即数字的整数部分 只有1位,小数部分至少有1位,该数字及其指数部分的正负号即使对正数也必定明确给出。 现以科学计数 ...
分类:其他好文   时间:2020-01-22 21:46:22    阅读次数:73
PTA乙级 (1052 卖个萌 (20分),(substr函数))
一、C++中substr函数用法 #include<string> #include<iostream> using namespace std; int main() { string s("12345asdf"); string a = s.substr(0,5); //获得字符串s中从第0位开 ...
分类:其他好文   时间:2020-01-22 21:39:48    阅读次数:81
滑动窗口(单调队列) C++版 Python版本
AcWing 154 滑动窗口 https://www.acwing.com/problem/content/156/ 给定一个大小为n≤106n≤106的数组。 有一个大小为k的滑动窗口,它从数组的最左边移动到最右边。 您只能在窗口中看到k个数字。 每次滑动窗口向右移动一个位置。 以下是一个例子: ...
分类:编程语言   时间:2020-01-22 20:19:29    阅读次数:109
二项式堆
#ifndef BINOMIAL_HEAP #define BINOMIAL_HEAP #include <vector> #include <algorithm> #include <iostream> template<typename T> struct BinomialNode { T va ...
分类:其他好文   时间:2020-01-22 20:13:05    阅读次数:77
POJ3764 The xor-longest Path
题意: 找出树上异或和最大的一条路径$p$ $$ _{xor}length(p)=\oplus_{e\in_p}w(e) $$ 01字典树。同样用到了简单的异或性质 $0\oplus a = a, a\oplus a = 0$ 定义$f(u,v)$为$u$到$v$的路径异或和。那么$f(u,v) = ...
分类:其他好文   时间:2020-01-22 20:12:45    阅读次数:64
树的深搜和广搜
树的深搜: 树的重心 思路:我们可以遍历每一个节点,获取当前节点除外以后的每一个连通块中的点的数量,用一个res变量存储,每次到最后的时候用一个ans存储res中的最小值。 1 #include <iostream> 2 #include <algorithm> 3 #include <cstrin ...
分类:其他好文   时间:2020-01-22 20:12:07    阅读次数:119
Kaprekar数的实现
#include<cstdio> #include<algorithm> #include<iostream> using namespace std; int num[5]={0}; bool cmpa(int a,int b) { return a < b; } bool cmpd(int a, ...
分类:其他好文   时间:2020-01-22 18:42:36    阅读次数:88
1019 数字黑洞 (20分)
#include <stdio.h> #include <vector> #include <algorithm> #include <string.h> #include <cmath> #include <stdlib.h> #include <iostream> using namespace ...
分类:其他好文   时间:2020-01-22 16:16:17    阅读次数:62
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!