HZNU 2019 Summer Selection contest 1
Posted tangent-1231
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HZNU 2019 Summer Selection contest 1相关的知识,希望对你有一定的参考价值。
A - Nastya Is Buying Lunch
B - Neko Performs Cat Furrier Transform
C - TV Shows
D - Pairs
E - Increasing by Modulo
F - Good Triple
G - The Tag Game
H - Money Transfers
I - Mahmoud and Ehab and the MEX
题意:给你一个大小为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;
J - Vitya and Strange Lesson
以上是关于HZNU 2019 Summer Selection contest 1的主要内容,如果未能解决你的问题,请参考以下文章
HZNU 2019 Summer training 6 -CodeForces - 622