# 2019.9.21个人赛

Stat # Origin Title
Solved 26 / 36 A AtCoder 4822 Alchemist
Solved 21 / 54 B AtCoder 4894 Build Stairs
Solved 26 / 28 C AtCoder 4858 One Clue
Solved 9 / 28 D AtCoder 4862 Green Bin
Solved 27 / 31 E AtCoder 4887 Red or Not
Solved 18 / 36 F AtCoder 4891 City Savers
Solved 19 / 37 G AtCoder 4873 ModSum
3 / 9 H AtCoder 4877 Summer Vacation

## A – Alchemist

### 通过代码：

#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;
double a[10010];
using namespace std;
int main(){
int n;
cin >> n;

REP(i, 0, n){
cin >> a[i];
}
sort(a, a+n);
double sum = 0;
REP(i, 1, n){
a[i] = (double)(a[i-1] + a[i])/2;
}
//cout << a[n - 1] << '\n';
printf("%.5f\n", a[n - 1]);
}


## B – Build Stairs

• 将正方形的高度减少1
• 没做什么。

### 解题代码：

#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
int main()
{

int n, h, m=0;
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> h;
if(h<m)
{
cout<<"No";
return 0;
}
m=max(m,h-1);
}
cout<<"Yes";
}

## C – One Clue

### 解题代码

#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;

using namespace std;
int main(){
int k,x;
cin >> k >> x;
for(int i=x-k+1;i<=x+k-1;i++)
cout<<i<<endl;
}

## 解题代码：

#include <bits/stdc++.h>
#define REP(i, a, b) for(int i = a; i < b; i++)
#define REP_(i, a, b) for(int i = a; i <= b; i++)
#define sl(n) scanf("%lld", &n);
#define si(n) scanf("%d", &n);
#define RepAll(a) for(auto x: a)
#define cout(ans) cout << ans << endl;
typedef long long ll;
using namespace std;
map <string,int> m;
string s;
long long ans=0;
using namespace std;
int main()
{
int n;
cin >> n;
while ( n--)
{
cin >> s;
sort(s.begin(), s.end());
//cout << m[s];
ans += m[s]++;
}
cout << ans;
}


## E – Red or Not

©️2019 CSDN 皮肤主题: 书香水墨 设计师: CSDN官方博客