Ответы
Ответ дал:
0
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
int n;
cin >>n;
int *a=new int[n]; /*Динамический массив из n элементов*/
srand(time(0));
double r=0;
for(int i=0;i<n; ++i)
{
a[i]=rand()%38 - 5;
r+=pow((sqrt(fabs(a[i]))-a[i]),2);
}
cout <<r<<endl;
delete [] a;
system("pause");
return EXIT_SUCCESS;
}
#include <iostream>
#include <ctime>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
int n;
cin >>n;
int *a=new int[n]; /*Динамический массив из n элементов*/
srand(time(0));
double r=0;
for(int i=0;i<n; ++i)
{
a[i]=rand()%38 - 5;
r+=pow((sqrt(fabs(a[i]))-a[i]),2);
}
cout <<r<<endl;
delete [] a;
system("pause");
return EXIT_SUCCESS;
}
Вас заинтересует
1 год назад
1 год назад
6 лет назад
6 лет назад
9 лет назад