Welcome, Guest! Sign Up RSS

Clever Space

Friday, 11.22.2024
Main » 2013 » September » 27
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define N 2510
int min(int a,int b)
{
  if (a<b) return a;
  return b;
}
int n,t,x,y,map[N][N],i,j,left[N][N],up[N][N],dp[N][N],m;
int main()
{
  scanf("%d %d",&n,&m);
  memset(map,0,sizeof(map));
  for (i=1;i<=n;i++)
   for (j=1;j<=m;j++) 
   {
     scanf("%d",&map[i][j]);
     if (!map[i][j]) up[i][j]=up[i-1][j]+1;
   }
  int max=0;
  for (i=1;i<=n;i++)
   for (j=1;j<=m;j++)
    if (map[i][j])
    {
      left[i][j]=0;
      dp[i][j]=min(dp[i-1][j-1],min(left[i][j-1],up[ ... Read more »
Views: 522 | Added by: dhy0077 | Date: 09.27.2013

忘记的密码(1A)

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<set>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<iostream>
#include<string>
#define N 1010
#define FOR(i,a,b) for(i=(a);i<=(b);i++)
#define ROF(i,a,b) for(i=(a);i>=(b);i--)
typedef long long LL;
using namespace std;
string S[N],T;
string dp[N];
int n,m;
int check(int p,string s)
{
  int i;
  FOR(i,0,s.size()-1)
  {
    if (T[i+p]=='?') continue;
    if (T[i+p]!=s[i]) return 0;
  }
  return 1;
}
int main()
{
... Read more »
Views: 484 | Added by: dhy0077 | Date: 09.27.2013