Krab Bark
Искусственный Интеллект
(294629)
2 недели назад
#include <iostream>
#include <random>
#include <algorithm>
using namespace std;
int main(){
int a=-99,b=99,n; cout<<"n: "; cin>>n; int *c=new int[n];
uniform_int_distribution<> uid(a,b);
mt19937 gen{random_device()()};
for(int i=0;i<n;i++)cout<<(c[i]=uid(gen))<<' '; cout<<endl;
int *ka=find_if(c,c+n,[](int i){return i<0;});
int *kb=find_if(ka+1,c+n,[](int i){return i<0;});
if(kb-c<n&&ka-c<n)cout<<kb-ka-1; else cout<<"none"; cout<<endl;
delete []c; return 0;}