ARC108

A
(quad)模拟

code

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<climits>
#include<sstream>
#include<fstream>
using namespace std;
#define int long long

signed main()
{
    int s , p;
    cin >> s >> p;
    for(register int i = 1 ; i * i <= p ; i++)
    {
        if(p % i != 0)
        {
            continue;
        }
        int n = i;
        int m = p / i;
        if(n + m == s)
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

B
(quad)模拟+1

code

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<climits>
#include<sstream>
#include<fstream>
using namespace std;
#include<stack>
#define int long long

const int N = 2e5 + 10;

stack<char> st;
char s[N];
char t[N];
int tot;

signed main()
{
    //freopen("B.in" , "r" , stdin);
    //freopen("B.out" , "w" , stdout);
    int n;
    cin >> n;
    int count = 0;
    for(register int i = 1 ; i <= n ; i++)
    {
        char c;
        cin >> c;
        st.push(c);
        if(st.size() >= 3)
        {
            int th = st.top();
            st.pop();
            int se = st.top();
            st.pop();
            int fs = st.top();
            st.pop();
            if(fs == 'f' && se == 'o' && th == 'x')
            {
                count++;
            }
            else
            {
                st.push(fs);
                st.push(se);
                st.push(th);
            }
        }
    }
    cout << n - count * 3;
    return 0;
}

C
(quad)咕咕咕

$——byquad wanwanjiuhao7744$
原文地址:https://www.cnblogs.com/wanwanjiuhao7744/p/15125930.html