#include <iostream>
#include <vector>
using namespace std;
int pos_sum(vector<int> &v){
int res = 0;
for(auto &i : v)
res += i * (i > 0);
return res;
}
int min_max_mult(vector<int> &v){
int res = 1;
pair<int,int> mn,mx;
mn = {v[0],0};
mx = mn;
for(int i = 1; i < v.size(); i++){
if(v[i] > mx.first){
mx.first = v[i];
mx.second = i;
if(v[i] < mn.first){
mn.first = v[i];
mn.second = i;
int st = min(mn.second, mx.second), fn = max(mn.second,mx.second);
for(int i = st + 1; i < fn; i++)
res *= v[i];
int main(){
int n;
cin >> n;
vector<int> a(n);
for(auto &i : a) cin >> i;
cout << pos_sum(a) << " " << min_max_mult(a);
<?php
namespace Word;
/**
* Класс для работы со словами.
*
* @package default
* @author `Roman`
*/
interface WordInterface {
public function caseChange();
class Word implements WordInterface {
public function __construct($word) {
$this -> word = $word;
public function caseChange($charset = "utf-8") {
return mb_strtoupper(mb_substr($this -> word, 0, 1, $charset), $charset) . mb_substr($this -> word, 1, mb_strlen($this -> word, $charset) - 1, $charset);
//testing:
$myWord = "слово";
$Word = new Word($myWord);
$newWord = $Word -> caseChange();
echo $newWord;
#include <iostream>
#include <vector>
using namespace std;
int pos_sum(vector<int> &v){
int res = 0;
for(auto &i : v)
res += i * (i > 0);
return res;
}
int min_max_mult(vector<int> &v){
int res = 1;
pair<int,int> mn,mx;
mn = {v[0],0};
mx = mn;
for(int i = 1; i < v.size(); i++){
if(v[i] > mx.first){
mx.first = v[i];
mx.second = i;
}
if(v[i] < mn.first){
mn.first = v[i];
mn.second = i;
}
}
int st = min(mn.second, mx.second), fn = max(mn.second,mx.second);
for(int i = st + 1; i < fn; i++)
res *= v[i];
return res;
}
int main(){
int n;
cin >> n;
vector<int> a(n);
for(auto &i : a) cin >> i;
cout << pos_sum(a) << " " << min_max_mult(a);
}
<?php
namespace Word;
/**
* Класс для работы со словами.
*
* @package default
* @author `Roman`
*/
interface WordInterface {
public function caseChange();
}
class Word implements WordInterface {
public function __construct($word) {
$this -> word = $word;
}
public function caseChange($charset = "utf-8") {
return mb_strtoupper(mb_substr($this -> word, 0, 1, $charset), $charset) . mb_substr($this -> word, 1, mb_strlen($this -> word, $charset) - 1, $charset);
}
}
//testing:
$myWord = "слово";
$Word = new Word($myWord);
$newWord = $Word -> caseChange();
echo $newWord;