# Codeforces 1030A. In Search of an Easy Problem(Codebait) [Codeforces Round

## 题面

### Description

When preparing a tournament, Codeforces coordinators try treir best to make the first problem as easy as possible. This time the coordinator had chosen some problem and asked $n$ people about their opinions. Each person answered whether this problem is easy or hard.

If at least one of these $n$ people has answered that the problem is hard, the coordinator decides to change the problem. For the given responses, check if the problem is easy enough.

### Input

The first line contains a single integer $n$ ($1 \le n \le 100$) — the number of people who were asked to give their opinions.

The second line contains $n$integers, each integer is either $0$or $1$. If $i$-th integer is $0$, then $i$-th person thinks that the problem is easy; if it is$1$, then$i$-th person thinks that the problem is hard.

### Output

Print one word: “EASY” if the problem is easy according to all responses, or “HARD” if there is at least one person who thinks the problem is hard.

You may print every letter in any register: “EASY”, “easy”, “EaSY” and “eAsY” all will be processed correctly.

# Codeforces Round #512 (Div. 2) [Personal Summary]

## My Status

A B C D E F G
O O O O Ø Ø Ø

solution

solution

solution

solution

unsolved

unsolved

unsolved

# A. Magic Mirror(新手题，字符串处理) [2018 ACM-ICPC Jiaozuo Online Contest]

## 题面

### Description

Jessie has a magic mirror.

Every morning she will ask the mirror: ‘Mirror mirror tell me, who is the most beautiful girl in the world?’ If the mirror says her name, she will praise the mirror: ‘Good guy!’, but if the mirror says the name of another person, she will assail the mirror: ‘Dare you say that again?’

Today Jessie asks the mirror the same question above, and you are given a series of mirror’s answers. For each answer, please output Jessie’s response. You can assume that the uppercase or lowercase letters appearing anywhere in the name will have no influence on the answer. For example, ‘Jessie’ and ‘jessie’ represent the same person.

### Input

The first line contains an integer $T(1 \le T \le 100)$, which is the number of test cases.

Each test case contains one line with a single-word name, which contains only English letters. The length of each name is no more than $15$.

### Output

For each test case, output one line containing the answer.

# 2018 ACM-ICPC Jiaozuo Online Contest [Personal Summary]

## My Status

A B C D E F G H I J K
O Ø Ø Ø Ø Ø Ø Ø O Ø Ø

A, I

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

solution:

unsolved

unsolved

unsolved

# H. Ryuji doesn't want to study (树状数组) [2018 ACM-ICPC Xuzhou Online Contest]

## 题面

### Description

Ryuji is not a good student, and he doesn’t want to study. But there are n books he should learn, each book has its knowledge $a[i]$.

Unfortunately, the longer he learns, the fewer he gets.

That means, if he reads books from ll to rr, he will get $a[l] \times L + a[l+1] \times (L-1) + \cdots + a[r-1] \times 2 + a[r]$($L$is the length of [ $l, r$ ] that equals to$r - l + 1$).

Now Ryuji has $q$ questions, you should answer him:

• If the question type is $1$, you should answer how much knowledge he will get after he reads books [ $l, r$ ].

• If the question type is $2$, Ryuji will change the $i$th book’s knowledge to a new value.

### Input

First line contains two integers $n$and$q$ ($n, q \le 100000$).

The next line contains n integers represent $a[i]$ $(a[i]≤1e9)$ .

Then in next $q$line each line contains three integers $a, b, c$, if $a = 1$, it means question type is $1$, and $b, c$represents [ $l , r$]. if $a = 2$, it means question type is$2$ , and$b, c$ means Ryuji changes the$b$th book’s knowledge to$c$ .

### Output

For each question, output one line with one integer represent the answer.

## 分析

$a[l] \times L + a[l+1] \times (L-1) + \cdots + a[r-1] \times 2 + a[r]$

• = $\sum\limits_{k=l}^{r}(r-l+1-(k-l)) \cdot a[k]$
• = $\sum\limits_{k=l}^{r}(r-k+1) \cdot a[k]$
• = $(r+1)\sum\limits_{k=l}^{r}a[k]-\sum\limits_{k=l}^{r}k \cdot a[k]$

# 2018 ACM-ICPC Xuzhou Online Contest [Personal Summary]

## My Status

A B C D E F G H I J K
Ø Ø Ø Ø Ø Ø Ø O Ø Ø Ø

H

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

# 2017 CCPC China-Hunan Invitional [Personal Summary]

## My Status

A B C D E F G H I J K
Ø Ø Ø Ø Ø O Ø Ø Ø Ø Ø

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

unsolved

# ACM Trick Points (持续更新)

## 函数

### memset 赋值

1. 整数的两倍不超过0x7fffffff（即INT_MAX）。
2. 整数的每8位都相同（恰好可以用memset填充）。

## 数学

### 余式定理

$\\P(a)=R(a) \\P(b)=R(b) \\P(c)=R(c) \\ \cdots$

## Attention Points

### 运算符优先级

+, - <<, >> >, <, ==, != & ^ 位或