Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
514 B
0
Indexable
Never
#include <iostream>
#include <math.h>
#include <algorithm>


float signal(double A, double xi, double B) {
	return std::sin(A * xi) + B;
}

float distortion(double signal, double La, double Lb) {
	if (signal < Lb) {
		return std::max(signal, La);
	}
	return std::min(signal, Lb);
}

int main() {

	int N;
	double A, B, La, Lb;
	double xi;
	std::cin >> N >> A >> B >> La >> Lb;
	for (int i = 0; i < N; i++) {
		std::cin >> xi;
		std::cout << distortion(signal(A,xi,B), La, Lb) << " ";
	}
}
Leave a Comment