
模板
「已注销」
这个作者很懒,什么都没留下…
展开
-
poj1503 Integer Inquiry(大数)
用的模板直接贴代码#include <vector>#include <iostream>#include <cstring>#include <iomanip>#include <string>#include <algorithm>using namespace std; //大数struct BigInteger{ static const int BASE = 100000000; //和WID原创 2020-10-03 14:01:55 · 141 阅读 · 0 评论 -
poj2566 Bound Found(尺取法:子串和为非单调序列,模板)
题目大意给定一组包含n个整数的数列和k个询问,求取一个子串,使得该***连续子串***的***和的绝对值***最接近t注:暴力求解必定超时解题思路由于要求取一个连续子串的部分和(和为非单调数列,若是单调数列,可不求和,直接算),这让我们想到了记录前缀和sum的方式来在O(1)内求得任意子串的和。对于子串问题的处理,为了避免暴力双重循环,我们往往使用尺取法(双指针法),就像是在字符串匹配问题时的那样。当然,其他的方法(如DP)也经常用来处理子串问题,最经典的有最长上升子序列。在使用双指针法时,要原创 2020-10-02 22:09:23 · 150 阅读 · 0 评论 -
poj3061 Subsequence(尺取法,模板)
最基本的尺取法尺取无序数列#include<algorithm>#include<iostream>#define INF 0x3f3f3f3f using namespace std;int t, n, s;int a[100005];int main(){ cin>>t; while(t--) { cin>>n>>s; for(int i = 1; i <= n; i++) cin>>a[原创 2020-10-02 15:18:42 · 144 阅读 · 0 评论