题目大意 额,写来写去,我还是直接说抽象之后的题目大意吧: 有一个 r*2 的矩形,两个人轮流的在矩形上面减去一个 1*1 的小正方形,要求在减的过程中,不能使矩形“断开”,也就是说,如果一个人减去了 (i, 1) 这个矩形,那么,(i-1, 2), (i+1, 2), (i, 2) 这三个小正方形不能再被减去了,因为一旦减去它们中的一个,整个矩形就会被“剪断” 现在给你一个 r 和 n (1 ≤ r ≤ 100, 0 ≤ n ≤ r),表示有一个 r*2 矩形,已经有了 n 个位置被减去了,再…
只有小写字母 那>=2600的直接找单字母串长度大于等于100的就可以了 <2600 的dp找最长回文串 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<stdlib.h> #include<vector> using namespace std; #define N 50010 char s[N]; ]…
题目链接:  http://codeforces.com/contest/335/problem/B 分析: 第一眼看上去串的长度为5*10^4, 冒似只能用O(n)的算法可解. 而这样的算法从来没见过...... 其实不然, 注意一个条件"如果有存在长度为100的回文子串则输出长度为100的,否则输出最长的", 可以发现: 一个长度大于100的回文串都可以变成长度为100的 如: 长度为101的只要删除中间的一个就变为长度为100的, 长度为102的删除中间两个也变为长度为100的.…
二分查找题, 不知道用double的人,用LL果断错了... B. Stadium and Games time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Daniel is organizing a football tournament. He has come up with the following tournament…
题目链接 http://codeforces.com/contest/325/problem/B 第一遍写了暴搜,果断TLE 然后上了二分,结果120组数据只有第40组过不了,我就写了奇怪的东西.... #include<stdio.h> #include<string.h> #include<iostream> #include<math.h> #include<vector> using namespace std; long long n;…
完全的乱搞题啊... 被坑的要死. 拿到题目就觉得是规律题加构造题, 然后找了了几个小时无果,只知道n为奇数的时候是一定无解的,然后当n为偶数的时候可能有很多解,但是如果乱选择的话,很有可能形成无解的情况. 然后想到了类似于估价函数之类的东西, 一开始我就想到了让几个关键的点设价值设成很大,然后在构造解的时候尽量不选这些点,然后... 发现数据到30左右就出错了.  然后再进一步的想,把每个点都估计一个价值,价值的大小为到0的距离. 然后就可以保证在构造解的时候尽量选离0远的点,这样一直选,一直…
D. MADMAX time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actu…
题意:对于正整数\(n\),每次可以选择使它变为\(n-1\)或者\(n/t\) (\(n\ mod\ t=0\)且\(t\)为奇数),当\(n=1\)时便不可以再取,问先手赢还是后手赢. 题解:首先特判\(1\)和\(2\)的情况,然后显然如果\(n\)是奇数,一定是先手赢. ​ 如果\(n\)是偶数,那么我们去找它的奇数因子. ​ 如果没有,那么先手只能减一,后手直接赢. ​ 如果有,那么我们直接将它的所有奇数因子拿走,剩下一个孤零零的偶数给后手,如果这个偶数不是\(2\)的话,先手赢,否则…
一.基本概念 1.AOP简介 DI能够让相互协作的软件组件保持松散耦合:而面向切面编程(aspect-oriented programming,AOP)允许你把遍布应用各处的功能分离出来形成可重用的组件.把这些横切关注点与业务逻辑相分离正是面向切面编程(AOP)所要解决的问题 常见场景:日志.安全.事物.缓存 2.AOP用到的一些术语 项目中每个模块的核心功能都是为特定业务领域提供服务,但是这些模块都需要类似的辅助功能,例如安全和事务管理,这时候需要引入AOP的概念. 通知定义了切面是什么以及何…
ok,我们讲讲svg 学习前提:懂HTML和基本的XML SVG简介: 1.SVG全称Scable Vector Graphic,可伸缩的矢量图 2.SVG用于定义针对于Web的基于矢量的图形 3.SCG用XML的形式定义了图片 4.SVG在缩放中永远不会失真 5.每个SVG中的元素和属性都可以进行动画设置 5.SVG是W3C大大推荐的! 6.SVG结合了W3C的标准,比如DOM和XSL <svg width="widthpx" height="heightpx&quo…
在res/drawable创建两个样式 点击前/点击后 round: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <!--设置渐变颜色 angle="是从左到右 90是从上到下 180是从右到左 --> <gradient and…
0. 我准备模拟两种情况 第一种 第二种 情况简析 仓库中的最新版本发现 Bug,需要立即修复 当前在 "dev" 分支中工作到一定程度,尚不能提交,但删之可惜 ps: 在分支中没有提交就切其他分支,改动部分会被覆盖 下面是 "Git" 的温馨提示 error: Your local changes to the following files would be overwritten by checkout: ... Please commit your chan…
题目描述 Again Alice and Bob is playing a game with stones. There are N piles of stones labelled from 1 to N, the i th pile has ai stones. First Alice will choose piles of stones with consecutive labels, whose leftmost is labelled with L and the rightmos…
Codeforces Round #535 E2-Array and Segments (Hard version) 题意: 给你一个数列和一些区间,让你选择一些区间(选择的区间中的数都减一), 求最后最大值与最小值的差值最大,并输出选择的区间 思路: 在n=300的时候,我们是枚举每个数作为最小值,应用所有覆盖它的区间,并且没 次都更行差值的最大值. 但是这里的n=1e5,所以我们不能用O(n*n*m),但是我们看到这里的m=300 所以可以从m入手,枚举区间,就是记录每个区间的两个端点,利用…
Codeforces Round #620 F2. Animal Observation (hard version) (dp + 线段树) 题目链接 题意 给定一个nm的矩阵,每行取2k的矩阵,求总共矩阵里的数的和最大值,重复取到的数不算 题解 dp[i]表示当前行从第i个数开始取矩阵的最大值 dp[i] = 上一行中最大数 + 当前行第i个数到第i+k-1个数的和 - 当前行重复的 + 下一行第i个数到第i+k-1个数的和 用线段树维护 上一行中最大数 + 当前行第i个数到第i+k-1个数的…
Codeforces Round #622 (Div. 2) C2. Skyscrapers (hard version) 题意: 你是一名建筑工程师,现给出 n 幢建筑的预计建设高度,你想建成峰状,如: 1 2 3 2 1 → 1 2 3 2 1 1 2 3 1 2 → 1 2 3 1 1 8 10 6 → 8 10 6 10 6 8 → 10 6 6 问所有建筑的高度和最大为多少. 思路: 单调递增栈栈顶存储以当前点为峰的单侧最低高度下标,另存储以每个点为峰的左右最大高度和. #includ…
https://codeforces.com/contest/1118/problem/D2 和easy version的主要区别是,数据增加了. easy version采用的是线性查找,效率低 在这里采用binary search就可以了 #include<bits/stdc++.h> using namespace std; int n,m; vector<int> num; int C(int d){ ; ;i<n;i++){ sum+=max(num[i]-i/d,…
一 题面 C2. Increasing Subsequence (hard version) 二 分析 需要思考清楚再写的一个题目,不能一看题目就上手,容易写错. 分以下几种情况: 1 左右两端数都小于等于构造的数组的最后一个数字 2 左右两端数至少有一个大于构造的数组最后一个数字 a. 左右两端数字相等,肯定满足上面条件.那么只可能走一个方向,两边都模拟一下,比一下大小即可 b. 左右两端数组不等,则优先看谁满足上面2的情况,若都满足则选最小的 三 AC代码 #include <bits/st…
http://codeforces.com/contest/1092/problem/D1 Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. Now it's totally up to Vova to put the finishing touches. The cur…
任意门:http://codeforces.com/contest/1118/problem/F1 F1. Tree Cutting (Easy Version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an undirected tree of nn vertices. Some vert…
任意门:http://codeforces.com/contest/1118/problem/D1 D1. Coffee and Coursework (Easy version) time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions…
传送门:http://codeforces.com/contest/1108/problem/E2 E2. Array and Segments (Hard version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions i…
传送门:http://codeforces.com/contest/1092/problem/D2 D2. Great Vova Wall (Version 2) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vova's family is building the Great Vova Wall (named by Vo…
传送门:http://codeforces.com/contest/1092/problem/D1 D1. Great Vova Wall (Version 1) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vova's family is building the Great Vova Wall (named by Vo…
F1. Pictures with Kittens (easy version) 题目链接:https://codeforces.com/contest/1077/problem/F1 题意: 给出n个数,以及k,x,k即长度为k的区间至少选一个,x的意思是一共要选x个,少一个或者多一个都不行. 选一个会得到一定的奖励,问在满足条件的前提下,最多得到多少的奖励. 题解: 简单版本数据量比较小,考虑比较暴力的动态规划. dp[i,j]表示前i个数,要选第i个数,目前选了j个所得到的最大奖励,那么当…
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vova's family is building the Great Vova Wall (named by Vova himself). Vova's parents, grandparents, grand-grandparents contributed to it. N…
F2. Wrong Answer on test 233 (Hard Version) Your program fails again. This time it gets "Wrong answer on test 233" . This is the harder version of the problem. In this version, 1≤n≤2⋅105. You can hack this problem if you locked it. But you can h…
D2. Optimal Subsequences (Hard Version) This is the harder version of the problem. In this version, 1≤n,m≤2⋅105. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems. You are given a seque…
D2. The World Is Just a Programming Task (Hard Version) This is a harder version of the problem. In this version,…
B2. Character Swap (Hard Version) This problem is different from the easy version. In this version Ujan makes at most 2…