About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

রবিবার, ৪ জানুয়ারী, ২০১৫

Uva solution : 10192- vacation

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;
int lcs(char *a,char *b,int m,int n)
{
    int ar[m+1][n+1];
    for(int i=0;i<=m;i++){
        for(int j=0;j<=n;j++){
            if(i==0||j==0) ar[i][j]=0;
            else if(a[i-1]==b[j-1]) ar[i][j]=ar[i-1][j-1]+1;
            else ar[i][j]=max(ar[i-1][j],ar[i][j-1]);
        }
    }

    return ar[m][n];

}
int main()
{
     char a[200],b[200];
     int cas=0;
     while(gets(a))
     {
          if(a[0]=='#') break;
         gets(b);
         int l1=strlen(a);
         int l2=strlen(b);
         int res=lcs(a,b,l1,l2);
         printf("Case #%d: you can visit at most %d cities.\n",++cas,res);
     }


    return 0;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন