HZNU 2019 Summer Selection contest 1

A - Nastya Is Buying Lunch

 CodeForces - 1136D 

 

 

B - Neko Performs Cat Furrier Transform

 CodeForces - 1152B 

 

 

C - TV Shows

 CodeForces - 1061D 

 

D - Pairs

 CodeForces - 1169B 

题意:有m对关系,关系里是两个整数,问你是否能找到两个数字 x,y 使得所有点对关系里至少有一个数字=x or =y。找的到输出YES,否则输出NO。

思路:比较暴力。我们先选出第一行的两个数,如果满足情况.

 

E - Increasing by Modulo

 CodeForces - 1169C 

 

F - Good Triple

 CodeForces - 1169D 

 

 

G - The Tag Game

 CodeForces - 813C 

 

H - Money Transfers

 CodeForces - 675C 

 

 

I - Mahmoud and Ehab and the MEX

 CodeForces - 862A 

题意:给你一个大小为n的集合,里面有0~100以内的数字,然后你要保证集合里缺少的数字为x。有插入和删除的操作,问你最少需要几步的操作。

思路:非常简单。不需要说明什么。就是读题有点久。

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<set>
#include<string>
#include<vector>
#include<ctime>
#include<stack>
#include<fstream>
#include<iomanip>
#include<deque>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define mm(a,b) memset(a,b,sizeof(a))
#define maxn 2*500000+50
#define len 150000000+5
#define inf 0x3f3f3f3f
int gcd(int a, int b)
{
    return a % b == 0 ? b : gcd(b, a%b);
}


int main()
{
    int n, x;
    int cnt[150] = {0};
    scanf("%d %d", &n, &x);
    for (int i = 0; i < n; i++)
    {
        int a;
        scanf("%d", &a);
        cnt[a]++;
    }
    if (x == 0)
    {
        printf("%d\n", cnt[0]);
    }
    else
    {
        int ans = 0;
        for (int i = 0; i < x; i++)
        {
            if (cnt[i] == 0) ans++;
        }
        ans += cnt[x];
        printf("%d\n", ans);
    }

    return 0;
}
View Code

 

J - Vitya and Strange Lesson

 CodeForces - 842D 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值