# 2020年04月19日个人赛

0
11

## A – Buggy Sorting

#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main(){
int n;
cin>>n;
if(n<=2){
cout<<-1;
}else{
for(int i=n;i>=1;i--){
cout<<i;
if(i!=1){
cout<<" ";
}
}
}
return 0;
}

## B – Increase and Decrease

#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main(){
int n;
cin>>n;
int num[100005]={0};
int sum=0;
for(int i=0;i<n;i++){
cin>>num[i];
sum=sum+num[i];
}
if(sum%n==0){
cout<<n<<endl;
}else{
cout<<n-1<<endl;
}
return 0;
}

## E – Dividing Orange

#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int main(){
ll n,k;
cin>>n>>k;
int num[1000]={0};
int vis[1000]={0};
int t;
for(int i=0;i<k;i++){
cin>>vis[i];
num[vis[i]]=1;
}
int len=0;
for(int i=0;i<k;i++){
len=0;
cout<<vis[i]<<" ";
len++;
for(int j=1;j<=n*k;j++){
if(len<n&&num[j]==0){
cout<<j;
num[j]=1;
len++;
if(len<=n-1){
cout<<" ";
}
}
}
cout<<endl;
}
return 0;
}

## F – Undoubtedly Lucky Numbers

#include<iostream>
#include<set>
#include<algorithm>
#define ll long long
using namespace std;
set<ll> st;
ll n;
void dfs(int a,int b,ll num){
st.insert(num);
ll ta=num*10+a;
ll tb=num*10+b;
if(ta&&ta<=n){
dfs(a,b,ta);
}
if(tb&&tb<=n){
dfs(a,b,tb);
}
}
int main(){
cin>>n;
for(int i=0;i<=9;i++){
for(int j=0;j<=9;j++){
dfs(i,j,0);/*每个数字都是从0开始的*/
}
}
cout<<st.size()-1;
return 0;
}

<

0