1000000000D WORLD
Автор: One Person Studio
Загружено: Feb 10, 2023
Просмотров: 39 views
Given two 1000000000D vectors A and B in compressed form. Find a dot product of two vectors
EXPLANATION CODE:
1) The a and b strings, correspondingly, hold the two input sequences. Then, two calls to the getVec() method are made to split these strings into v1 and v2—two integer vectors.
2) The code then initializes several integer variables: ret, n, m, count, and times.
3) The main algorithm of the code is then executed within a while loop. In each iteration of the loop, the code compares the values of the n-th element of v1 and the m-th element of v2, and stores the smaller value in the times variable. It then subtracts times from both v1[n] and v2[m], adds times to count, and adds times * v1[n+1] * v2[m+1] to ret. Finally, it increments n and m by 2 if v1[n] or v2[m] is zero, respectively.
4) The output of the code is the value of ret.
#codingame #coding #game #programming #easy #difficulty #reading #arithmetic #cplusplus #cplusplusprogramming #learntocode #tutorial #education #problemsolving #algorithmic #asmr #asmrtyping #onebillion #world

Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: