Ad
Code
Diff
  • #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 = 0
    • for i in arr:
    • result += i
    • return 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;
    • }