-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9b.cpp
More file actions
38 lines (33 loc) · 712 Bytes
/
9b.cpp
File metadata and controls
38 lines (33 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <unordered_set>
using namespace std;
typedef long long ll;
ll num_search=393911906;
int main(){
vector<ll> lista;
ll dato;
vector<ll> numeros;
while(cin>>dato){
lista.push_back(dato);
}
ll igualito=0;
int i=0;
while(i<lista.size()){
if(igualito>num_search){
igualito-=numeros[0];
numeros.erase(numeros.begin());
}else if(igualito<num_search){
numeros.push_back(lista[i]);
igualito+=lista[i];
i++;
}else{
cout<<" "<<*max_element(numeros.begin(), numeros.end())+*min_element(numeros.begin(), numeros.end())<<endl;
return 0;
}
}
cout<<"no lo encontraste"<<endl;
}