#include <vector> using namespace std; int result ( vector <int> sum ) { if ( sum.size() == 0 ) return 0; int somma_totale = 0; for ( int i = 0; i < sum.size(); i++ ) { somma_totale = somma_totale + sum[i]; } return somma_totale; }
def sum(arr):result = 0for i in arr:result += ireturn result- #include <vector>
- using namespace std;
- int result ( vector <int> sum ) {
- if ( sum.size() == 0 )
- return 0;
- int somma_totale = 0;
- for ( int i = 0; i < sum.size(); i++ ) {
- somma_totale = somma_totale + sum[i];
- } return somma_totale;
- }