[cf670div2]cf补打

前言

今天开始军训但是下雨了(wryyyyyyyyyyyyy),于是在宿舍整理内务,那么顺便补一发之前的cf比赛qwq

Ps:下雨天会(偷偷)抽时间做,不定期更新直至补完

A题

传送门

就统计每个数出现次数讨论一下就完了= =

Code

//By zuiyumeng
#pragma GCC optimize(2)
#include <queue>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define Re register
#define Ms(a,b) memset((a),(b),sizeof(a))
#define Fo(i,a,b) for(Re LL i=(a),_=(b);i<=_;i++)
#define Ro(i,a,b) for(Re LL i=(b),_=(a);i>=_;i--)
// #define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin)),p1==p2?EOF:*p1++)
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
 
char buf[1<<21],*p1,*p2;
inline int read() { 
    int x=0,f=1;char c=getchar();
    while(!isdigit(c)) {if(c=='-')f=-f;c=getchar();}
    while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
    return x*f;
}

const LL INF=9e19;
const int N=110;
int n,ma,mb;
int a[N];
bool vis[N];

int main() {
    int t=read();
    while(t--) {
        n=read(); Ms(a,0);
        Fo(i,1,n) a[read()]++;
        int flag=0,ans=0;
        Fo(i,0,100) {
            if(a[i]==1) {if(!flag) ans+=i,flag++;}
            if(a[i]==0) {
                if(flag) ans+=i,flag++;
                else ans+=i*2,flag=2;
            } 
            if(flag==2) break;
        }
        cout<<ans<<endl;
    }
    return 0;
}
posted @ 2020-09-14 12:26  醉语梦  阅读(118)  评论(0编辑  收藏  举报