A Simple Implementation of Nussinov Algorithm
The Nussinov algorithm is a dynamic programming-based nucleic acid structure prediction algorithm used in computational biology to predict the folding of an RNA molecule. It...
AtCoder Grand Contest 038
A. 01 Matrix 本来很简单的一道题,因为只需随便找出一种满足条件的矩阵,所以很容易看出左上角和右下角为0,其余为1的矩阵一定满足条件。我居然想了很久,太蒻了。 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <vector> #include <queue> #include...
AtCoder Grand Contest 039
老刷水题也没有意思,难的题又做不出来,只能捡些题来做,果然菜是原罪。 A. Connection and Disconnection 单独考虑全是一种字母的情况。 如果不是,就把每个字符串分成三段,前中后,如果前和后一样,再另行计算。细节较多,慢慢写不难。 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <vector>...
AtCoder Beginner Contest 144
前四道签到,至少这次没翻车 A. 9×9 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <vector> #include <queue> #include <functional>...
AtCoder Beginner Contest 143
前三道签到 A. Curtain #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <vector> #include <queue> #include <functional>...
Leetcode #5
学习了一下Manacher算法,简单来说就是从中心往外扩展,同时利用len数组,根据对称性,省去不必要的扫描,具体做法见https://www.cnblogs.com/mini-coconut/p/9074315.html class Solution { public: string longestPalindrome(string s) { string manaStr = "$#"; for (int i = 0; i < s.size(); i++) //首先构造出新的字符串 { manaStr...
Leetcode #4
class Solution { public: double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) { int n = nums1.size(); int m = nums2.size(); if(n > m) return findMedianSortedArrays(nums2,nums1); //确保nums1长度更小 int...
AtCoder Beginner Contest 142
前四道都是签到题,直接放代码 A. Odds of Oddness #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <cstdlib> #include <algorithm> #include <cstring> #include <string> using namespace std; int main() {...
Simulate Login
1. Sessions are a series of actions that do not lose states. 2. Cookies store credentials that are used to identify users. 3. Analogous to...
「Binary Tree」Extension
在普通的二叉树(链式结构)上增加了一些功能 bitree.h typedef int Status; typedef int TElemType; typedef struct BiTNode { TElemType data; struct BiTNode *lchild, *rchild; } BiTNode, *BiTree; Status InitBiTree(BiTree *T); Status...