I would like to thank all the participants for their participation hope you enjoyed the problems , I'm Really Shocked to reach about 100 participants joined the contest Problems
Idea
Solution
Idea
Solution
Idea
Solution
| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | turmax | 3559 |
| 6 | tourist | 3541 |
| 7 | strapple | 3515 |
| 8 | ksun48 | 3461 |
| 9 | dXqwq | 3436 |
| 10 | Otomachi_Una | 3413 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 147 |
| 4 | Proof_by_QED | 146 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
Practice #1 Editorial
I would like to thank all the participants for their participation hope you enjoyed the problems , I'm Really Shocked to reach about 100 participants joined the contest Problems
The Sum $$$\sum_{x=1}^{n}x^3$$$ has a closed form which is $$$(\frac{n(n+1)}{2})^2$$$
x=int(input())
print(x*(x+1)*x*(x+1)//4)
since the sum of numbers from $$$1$$$ to $$$n$$$ has a closed form $$$\frac{n(n+1)}{2}$$$ we can obtain the missing number by sum all the numbers from $$${1}$$$ to $$${n}$$$ (inclusive) and then sum the given numbers $$${x_1,x_2,x_3...,x_{n-1}}$$$ and find the difference so the final solution is $$$\frac{n(n+1)}{2}-\sum_{i=1}^{n-1}x_i$$$
n=int(input())
x=list(map(int,input().split()))
print(n*(n+1)//2-sum(x))
The Idea Here is Linearize the Time Complexity by using efficient popular algorithm called "Kadane's Algorithm" that maximize the sum in each iteration to get with the maximum subarray in $$$O(n)$$$ time complexity
n=int(input())
x=list(map(int,input().split()))
sm,best=0,0
for i in range(len(x)):
sm=max(x[i],sm+x[i])
best=max(best,sm)
print(best)
| Rev. | Язык | Кто | Когда | Δ | Комментарий | |
|---|---|---|---|---|---|---|
| en7 |
|
I_HATE_DBCHEATERS | 2023-08-25 19:41:29 | 43 | ||
| en6 |
|
I_HATE_DBCHEATERS | 2023-08-25 19:40:36 | 8 | Tiny change: ''m Really Shocked to reach' -> ''m Really proud to reach' | |
| en5 |
|
I_HATE_DBCHEATERS | 2023-08-25 18:51:56 | 3 | (published) | |
| en4 |
|
I_HATE_DBCHEATERS | 2023-08-25 18:51:31 | 614 | ||
| en3 |
|
I_HATE_DBCHEATERS | 2023-08-25 18:46:45 | 589 | ||
| en2 |
|
I_HATE_DBCHEATERS | 2023-08-25 18:43:13 | 1082 | Tiny change: 'spoiler>\n\n\n<spoiler' -> 'spoiler>\n<spoiler' | |
| en1 |
|
I_HATE_DBCHEATERS | 2023-08-25 18:30:12 | 568 | Initial revision (saved to drafts) |
| Название |
|---|


