Untitled
unknown
c_cpp
8 months ago
472 B
1
Indexable
Never
#include <iostream> #include <math.h> #include <algorithm> 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; double signal; std::cin >> N >> A >> B >> La >> Lb; for (int i = 0; i < N; i++) { std::cin >> xi; signal = std::sin(A * xi) + B; std::cout << distortion(signal, La, Lb) << " "; } }
Leave a Comment