HZNU 2019 Summer Selection contest 1

Posted tangent-1231

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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 

 

 

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 

 

以上是关于HZNU 2019 Summer Selection contest 1的主要内容,如果未能解决你的问题,请参考以下文章

HZNU 2019 Summer training 6

HZNU 2019 Summer training 8

HZNU 2019 Summer training 6 -CodeForces - 622

CSCI 3130, Summer 2019

MAGELINE SPRING/SUMMER 2019鲜美高级脸

Wooden Sticks -HZNU寒假集训