allcoding1
27.6K subscribers
2.2K photos
2 videos
77 files
853 links
Download Telegram
👍2
allcoding1
Photo
#include<bits/stdc++.h>
using namespace std;

const int MOD = 1e9 + 7;
vector<vector<vector<string>>> dp;

vector<string> solve(string& alice, string& bob, int i, int j) {
    if(i == alice.size() || j == bob.size()) {
        return {""};
    }
    if(dp[i][j].size() != 0) {
        return dp[i][j];
    }
    if(alice[i] == bob[j]) {
        vector<string> tmp = solve(alice, bob, i+1, j+1);
        for(string& s : tmp) {
            s = alice[i] + s;
        }
        return dp[i][j] = tmp;
    }
    vector<string> left = solve(alice, bob, i+1, j);
    vector<string> right = solve(alice, bob, i, j+1);
    if(left[0].size() > right[0].size()) {
        return dp[i][j] = left;
    }
    if(left[0].size() < right[0].size()) {
        return dp[i][j] = right;
    }
    left.insert(left.end(), right.begin(), right.end());
    sort(left.begin(), left.end());
    left.erase(unique(left.begin(), left.end()), left.end());
    return dp[i][j] = left;
}

int main() {
    int T;
    cin >> T;
    while(T--) {
        string alice, bob;
        cin >> alice >> bob;
        dp = vector<vector<vector<string>>>(alice.size(), vector<vector<string>>(bob.size()));
        vector<string> trips = solve(alice, bob, 0, 0);
        for(string& trip : trips) {
            cout << trip << endl;
        }
    }
    return 0;
}

Telegram:- @allcoding1
👍2🎉1
Telegram:- @allcoding1
1👍1
Two friends problem

Telegram:- @allcoding1
int main()
{
    string text;
    getline(cin, text);

    int index = 0;

    while (index + 13 < text.length() && (index = text.rfind(" ", index + 13)) != string::npos) {
        text.replace(index, 1, "\n");
    }

    cout << text << endl;

    return 0;
}

INFA thon 4.0

Telegram:- @allcoding1
👍1
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define max_v 25
bool f(double A,double B,double a,double b)
{
    double d=sqrt(a*a+b*b);
    double a1=asin(A/d);
    double a2=asin(b/d)*2.0;
    double h=cos(a1-a2)*d;
    if(B>h)
        return true;
    else
        return false;
}
int main()
{
    int t;
    bool flag;
    cin >> t;
    while(t--)
    {
        double A,B,a,b;
        cin >> A >> B >> a >> b;
        if(A<B)
            swap(A,B);
        if(a<b)
            swap(a,b);
        if(A>a&&B>b)
        {
            flag=true;
        }
        else if(A*B<=a*b||b>=B)
        {
            flag=false;
        }else
        {
            flag=f(A,B,a,b);
        }
        if(flag)
        {
            cout << "Escape is possible." << endl;

        }else
        {
            cout << "Box cannot be dropped." << endl;

        }
    }
    return 0;
}

INFAthon 4.0

Telegram:- @allcoding1
👍3🔥1
Diverse Deputations
Python 3

Telegram:- @allcoding1
👍2
Accenture exam Answer 2/4/24
@allcoding1

1) I got sick, I have _

As) an

2) A) but everyone
B) government
C) an should
D) global..

As) DBAC


3) ocean : shallow
As) infinite

4) I comb my hair....

As) I used to

5) antonym word " ACCURATE "

As) invalid


6) Continue

As) prolong


7) we felt____missing the farewell party

As) didn't feel good

@allcoding1

8) horizontal bar represent

As) date input/output

9) charvi is the mother of sara...

As) sister in law


10) by the time we arrived they____ (to leave)

As) had left


11) 1) it is possible to determine....
2) no other mobile brand....

As) both conclusion follow



Telegram:- @allcoding1
👍10
F
Cat : feline
Husband
Only conclusion I follow
Near
Reopening ans👇
20
22
👍1
Small program