Ignatius and the Princess II Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4571 Accepted Submission(s): 2733 Problem Description Now our hero finds the door to the BEelzebub feng5166. He o…
区间DP大暴力吧?GG. dp[ i ] 为字符至 i 的最少数量. 如果[Left , Right]是回文串, dp[Right] = min(dp[ Right ] , dp[Left-1] + 1); #include<bits/stdc++.h> using namespace std; const int N=5e3+10; int dp[N]; char a[N]; int n; int main(){ scanf("%s",a+1);n=strlen(a+1)…
自己模拟,全靠体会~ #include <cstdio> #include <stack> #include <iostream> #include <string.h> #include <algorithm> using namespace std; typedef long long LL; const int N=5e4+10; LL a[N]; int main() { int n; scanf("%d",&…
思路: 暴力整个图,以这个为起点,然后看一下有没有找到一条路是会指向自己且元素个数>=4: #include <bits/stdc++.h> using namespace std; typedef long long LL; const int mod=1e9+7; const int N=55; char ma[N][N]; bool vis[N][N]; int n,m; int s,t; int flag; int dx[4]={0,0,-1,1}; int dy[4]={1,-…