Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7501 - Массив тэгээс их нийлбэр

Өгөгдсөн нэг хэмжээст массивын 0-ээс их элементүүдийн нийлбэрийг ол.

Input

Эхний мөрөнд массивын элементийн тоо.

Дараагийн мөрүүдэд массивын элементүүд нэг нэгээрээ өгөгдөнө.

Output

Нийлбэр.

Example

Input:
4
5
-3
4
-10

Output:
9

Нэмсэн:Bataa
Огноо:2013-01-15
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2020-10-07 05:09:58
no

2020-08-27 14:38:35
#include <iostream>
using namespace std;

int main() {
int n;
cin >> n;
int numbers[n];
for (int i = 0; i < n; i++) cin >> numbers[i];
int sum = 0;
for (int i = 0; i < n; i++){
if(numbers[i]>0)
sum += numbers[i];
}
cout << sum << endl;
return 0;

}

Last edit: 2020-08-27 14:39:39
2020-04-13 09:43:34
#include <iostream>
using namespace std;

int main() {

long long n;

cin>> n;

long long arr[n], i, max = -9999999, pos;

for(i = 0 ; i <= n - 1 ; i++){

cin>> arr[i];

if(arr[i] > max){

max = arr[i];

}

}

for(i = 0; i <= n - 1 ; i++){

if(arr[i] == max){

pos = i + 1;

cout<< max << " " << pos;

return 0;

}

}


return 0;
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.