A - QQ solver

题目描述

code:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int maxn=1e6+5;
void solve(){
   
    string s;
    cin>>s;
    cout << (s[0] - '0') * (s[2] - '0') << endl;
}

int main(){
   
    ios::sync_with_stdio(0);
    int t;
    t = 1;
    while(t--){
   
         solve();
    }
    return 0;
}

B - Caesar Cipher

题目描述

code:


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int maxn=1e6+5;
void solve(){
   
    string s,t;
    cin >> s;
    cin >> t;
    int cur;
    for(int i=0; i<s.size(); i++){
   
    	int del;
    	if(t[i] > s[i])del = t[i] - s[i];
    	else{
   
    		del = 'z' - s[i] + t[i] - 'a' + 1;
    	}
    	if(i == 0)cur = del;
    	else if(cur != del){
   
    		cout<<"No\n"; return;
    	}
    }
    cout<<"Yes\n";
}

int main(){
   
    ios::sync_with_stdio(0);
    int t;
    t=1 ;
    while(t--){
   
         solve();
    }
    return 0;
}

C - Graph Isomorphism

题目描述

code:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int maxn = 1e6 + 5;
void solve()
{
   
    int n, m;
    cin >> n >> m;
    vector<unordered_set<int>> mp(n);
    for (int i = 0; i < m; i++)
    {
   
        int a, b;
        cin >> a >> b;
        a--, b--;
        mp[a].insert(b);
        mp[b].insert(a);
    }
    vector<int> v(n);
    for (int i = 0; i < n; i++)
        v[i] = i;

    vector<pii> edge(m);
    for (int i = 0; i < m; i++)
    {
   
        cin >> edge[i].first >> edge[i].second;
    }
    do
    {
   
        bool flag = true;
        for (int i = 0; flag && i < m; i++)
        {
   
            int a = v[edge[i].first - 1];
            int b = v[edge[i].second - 1];
            flag = mp[a].count(b);
        }
        if (flag)
        {
   
            cout << "Yes";
            return;
        }
    } while (next_permutation(v.begin(), v.end()));
    cout << "No";
}

int main()
{
   
    ios::sync_with_stdio(0);
    int t;
    t=1;
    while (t--)
    {
   
        solve();
    }
    return 0;
}


D - Weak Takahashi

题目描述

code:


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

const int maxn=1e6+5;
char mp[110][110];
bool rch[110][110];
void solve()
{
   
    int h,w;
    cin >> h >> w;
    for(int i = 0;i < h;i++){
   
        cin >> mp[i];
    }
    if(mp[0][0]=='.') rch[0][0] = true;
    for(int i = 1;i < w;i++) if(mp[0][i]== '.' && rch[0][i-1]) rch[0][i] = true;
    for(int i = 1;i < h;i++) if(mp[i][0]== '.' && rch[i-1][0]) rch[i][0] = true;
    for(int i = 1;i < h;i++){
   
        for(int j = 1;j < w;j++){
   
            if(mp[i][j] == '.' && (rch[i-1][j]||rch[i][j-1])) rch[i][j] = true;
        }
    }
    int ans = 0;
    for(int i = 0;i < h;i++){
   
        for(int j = 0;j < w;j++){
   
            if(rch[i][j]) ans = max(ans,i+j+1);
        }
    }
    cout << ans << endl;
}
int main(){
   
    ios::sync_with_stdio(0);
    int t;
    //cin >> t ;
    t = 1;
    while(t--){
   
         solve();
    }
    return 0;
}