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
2022-03-24 05:47:03
import java.util.*;
import java.lang.*;

class Main
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner std = new Scanner(System.in);
int n = std.nextInt();
int myArray[] = new int [n];
int b = 0;


for(int i=0; i<n; i++){
myArray[i] = std.nextInt();
if(myArray[i]>0) {
b = b + myArray[i];
}
}
System.out.println(b);
}
}
2021-12-15 17:08:32
var a = [4,5,-3,-10];
var b = 0;
for(var i = 0; i < a.length; i++){
if(a[i] > 0){
b = b + a[i];
}
}
console.log(b);
JS
2021-07-03 08:37:43
aaaaaaa
2020-11-14 05:07:06
nani
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.