1001.Calculus(函数收敛性判断)(2021“MINIEYE杯”中国大学生算法设计超级联赛4)

传送门

题意:题目要求判断S(x)函数在正无穷是是否收敛,给出S(x)是f(x)的前缀和,而f(x)又是函数集合F中的n个子函数组合而成的,题目t组数据,每次给出f(x)函数,求S(x)的收敛性。

思路:由于S(x)需要收敛,于是F集合中具有周期波动性的子函数就不可取,再者S(x)是f(x)的前缀和,于是F中无论是单调还是不单调的子函数甚至常量也是不可取的(0除外)。于是题目就变得很简单了,由于C又是非负的常量,便不会存在子函数的加减相互抵消;我们子需要通过判断是否有除0以外的常量存在即可。

代码实现:

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cstring>
#include <iostream>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#define endl '\n'
#define null NULL
#define ll long long
#define int long long
#define pii pair<int, int>
#define lowbit(x) (x &(-x))
#define ls(x) x<<1
#define rs(x) (x<<1+1)
#define me(ar) memset(ar, 0, sizeof ar)
#define mem(ar,num) memset(ar, num, sizeof ar)
#define rp(i, n) for(int i = 0, i < n; i ++)
#define rep(i, a, n) for(int i = a; i <= n; i ++)
#define pre(i, n, a) for(int i = n; i >= a; i --)
#define IOS ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
const int way[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
using namespace std;
const int  inf = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-6;
const ll   mod = 1e9 + 7;
const int  N = 2e5 + 5;

inline void read(int &x){
    char t=getchar();
    while(!isdigit(t)) t=getchar();
    for(x=t^48,t=getchar();isdigit(t);t=getchar()) x=x*10+(t^48);
}

int T = 1;
string s;

signed main()
{
    IOS;

    cin >> T;

    while(T --){
        cin >> s;
        int ok = 0;
        for(int i = 0; i < s.size(); i ++){
            if('0'<s[i]&&s[i]<'9'){
                ok = 1;
                break;
            }
        }
        cout << (ok?"NO":"YES") << endl;
    }

    return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值