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;
}

J - Vitya and Strange Lesson

CodeForces - 842D

原文地址:https://www.cnblogs.com/Tangent-1231/p/11134610.html

时间: 2024-10-05 05:04:38

HZNU 2019 Summer Selection contest 1的相关文章

SDUT 2162-The Android University ACM Team Selection Contest(模拟)

The Android University ACM Team Selection Contest Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Now it's 20000 A.D., and the androids also participate in the ACM Inter-national Collegiate Programming Contest (ACM/ICPC). In order to selec

HDU校赛 | 2019 Multi-University Training Contest 3

2019 Multi-University Training Contest 3 http://acm.hdu.edu.cn/contests/contest_show.php?cid=850 1004. Distribution of books 考虑二分答案,设当前二分出来的是\(x\). 设\(f_i\)表示前\(i\)个能分成最多的段数,使得每一段和都\(\leqslant x\). 转移显然,枚举一个\(j\),若\(s_i-s_j\leqslant x\)则转移,\(s_i\)表示前

[最短路,最大流最小割定理] 2019 Multi-University Training Contest 1 Path

题目:http://acm.hdu.edu.cn/showproblem.php?pid=6582 Path Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 3747    Accepted Submission(s): 1075 Problem Description Years later, Jerry fell in love

2019 GDUT Rating Contest III : Problem C. Team Tic Tac Toe

题面: C. Team Tic Tac Toe Input ?le: standard input Output ?le: standard output Time limit: 1 second Memory limit: 256 megabytes Farmer John owns 26 cows, which by happenstance all have names starting with different letters of the alphabet, so Farmer J

2019 GDUT Rating Contest I : Problem G. Back and Forth

题面: G. Back and Forth Input ?le: standard input Output ?le: standard output Time limit: 1 second Memory limit: 256 megabytes Farmer John has two milking barns, each of which has a large milk tank as well as a storage closet containing 10 buckets of v

HZNU 2019 Summer training 6 -CodeForces - 622

A - Infinite Sequence  CodeForces - 622A 题目大意:给你一个这样的数列1,1,2,1,2,3,1,2,3,4,1,2,3,4,5....就是从1~n排列(n++).最后问你第n个位置是什么数字. 思路:如果你花点时间列数列的话会发现,1~n的最后一位对应的位置是1~n的和,那我们就大胆使用二分进行搜索这位数. #include<iostream> #include<algorithm> #include<cstdio> #incl

HZNU 2019 Summer training 4

A - Little C Loves 3 I CodeForces - 1047A 题意:一个数分成三份,每一个都不是3的倍数 题解:分成 (1, 1, n - 2) 或者分成(1, 2, n - 3 ) #include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <vector> #in

HZNU 2019 Summer training 6

A - Infinite Sequence CodeForces - 622A 题意:第一个数是1,接下来是1和2,接下来是1,2, 3,接下来是1,2,3, 4,问第n个数是什么 题解:找出第几轮在找出第几个 #include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <vector>

HZNU 2019 Summer training 8

A - Petya and Origami CodeForces - 1080A 题意:制造一份邀请函需要2份a物品,5份b物品,8份c物品,一个盒子里面有k份物品(可以为a或b或c)问你制造n份邀请函需要用多少个盒子 题解:加起来就行了 #include <iostream> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include &