Practice #1 Editorial
Difference between en5 and en6, changed 8 character(s)
**I would like to thank all the participants for their participation hope you enjoyed the problems , I'm Really Shockeproud to reach about 100 participants joined the contest**↵
[Problems](https://codeforces.net/contestInvitation/5c0e761de9e4ccb3e94e9986db6567b970647d40)↵


[A. Cubes](https://codeforces.net/gym/469486/problem/A)↵

<spoiler summary="Idea">↵
The Sum $\sum_{x=1}^{n}x^3$ has a closed form which is $(\frac{n(n+1)}{2})^2$↵
</spoiler>↵


<spoiler summary="Solution">↵
~~~~~↵
x=int(input())↵
print(x*(x+1)*x*(x+1)//4)↵
~~~~~↵
</spoiler>↵

[B. Missing Number](https://codeforces.net/gym/469486/problem/A)↵

<spoiler summary="Idea">↵
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$↵
</spoiler>↵


<spoiler summary="Solution">↵
~~~~~↵
n=int(input())↵
x=list(map(int,input().split()))↵
print(n*(n+1)//2-sum(x))↵
~~~~~↵
</spoiler>↵

[C. Max Sub Array](https://codeforces.net/gym/469486/problem/C)↵

<spoiler summary="Idea">↵
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↵
</spoiler>↵


<spoiler summary="Solution">↵
~~~~~↵
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)↵
~~~~~↵
</spoiler>↵

[D. PPV or math](https://codeforces.net/gym/469486/problem/D)↵

<spoiler summary="Idea">↵
The Idea is to (string add) numbers even with themselves , so if we have n numbers then we will have $n*n=n^2$ (string add) operations that means that Time Complexity Here will Be $O(n^2)$ and of course in the iteration converting the string to integer and adding to the sum ↵
</spoiler>↵


<spoiler summary="Solution">↵
~~~~~↵
n=int(input())↵
x=input().split()↵
ar=[]↵
for i in range(n):↵
    for j in range(n):↵
        ar.append(x[i]+x[j])↵
ar=list(map(int,ar))↵
print(sum(ar))↵
~~~~~↵
</spoiler>↵

[E. Teams](https://codeforces.net/gym/469486/problem/E)↵

<spoiler summary="Idea">↵
The Idea here is to find how many (Integer-Pairs) we can make using number $n$ , most of solution used *//* operation which can lies on large values so it's preferred to use *math* library which is already designed well to hold large values so *floor* is better choice so that answer is $\lfloor \frac{x}{2} \rfloor$  ↵
</spoiler>↵


<spoiler summary="Solution">↵
~~~~~↵
from math import *↵
print(floor(int(input())/2))↵
~~~~~↵
</spoiler>↵

Hope You Guys Enjoyed The Contest Stay Tuned For More !↵
*Best Wishes*

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en7 English romanregins 2023-08-25 19:41:29 43
en6 English romanregins 2023-08-25 19:40:36 8 Tiny change: ''m Really Shocked to reach' -> ''m Really proud to reach'
en5 English romanregins 2023-08-25 18:51:56 3 (published)
en4 English romanregins 2023-08-25 18:51:31 614
en3 English romanregins 2023-08-25 18:46:45 589
en2 English romanregins 2023-08-25 18:43:13 1082 Tiny change: 'spoiler>\n\n\n<spoiler' -> 'spoiler>\n<spoiler'
en1 English romanregins 2023-08-25 18:30:12 568 Initial revision (saved to drafts)