从这里开始 题目目录 Problem A Dividing a String 猜想每段长度不超过2.然后dp即可. 考虑最后一个长度大于等于3的一段,如果划成$1 + 2$会和后面相同,那么划成$2 + 1$,如果前一段和前面相同,那么把前一段和前面合并.每次操作后段数都不会减少.所以存在一种最优方案使得每段长度不超过2. Code #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N =…
AtCoder Grand Contest 005 A - STring 翻译 给定一个只包含\(ST\)的字符串,如果出现了连续的\(ST\),就把他删去,然后所有位置前移.问最后剩下的串长. 题解 模拟栈,和维护括号一样的. #include<iostream> #include<cstring> using namespace std; #define MAX 200200 char ch[MAX]; int ans,tot; int main() { cin>>…
Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement We have an integer sequence A, whose length is N. Find the number of the non-empty contiguous subsequences of A whose sums are 0. Note that we are counting the ways to take…
Atcoder/Topcoder 理论 AC Atcoder的❌游戏示范 兴致勃勃地打开一场 AGC 看 A 题,先 WA 一发,然后花了一年时间 Fix. 看 B 题,啥玩意?这能求? 睡觉觉. emmmmm 虽然这些副本里的怪一点也不友善,但是却能给直感[1]带来极大的提升. [1]:「直感」是在战斗中一瞬间判明「对自身最适合行动」的能力 Atcoder Grand Contest 2 B. Box and Ball 口胡 考虑 \(k\) 次操作后可能出现红球的集合,记录每个集合球的个数.…
来之不易的2017第一发ac http://poj.org/problem?id=2386 Lake Counting Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 31474 Accepted: 15724 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is repr…