Advertisement
a53

Gradient_70p

a53
Jan 19th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int R1,G1,B1,R2,G2,B2,n;
  8. cin>>R1>>G1>>B1>>R2>>G2>>B2>>n;
  9. cout<<R1<<", "<<G1<<", "<<B1<<'\n';
  10. int r=abs(R2-R1)/(n-1),g=abs(G2-G1)/(n-1),b=abs(B2-B1)/(n-1);
  11. for(int i=2;i<n;++i)
  12. {
  13. if(R1<R2)
  14. R1+=r;
  15. else
  16. R1-=r;
  17. if(G1<G2)
  18. G1+=g;
  19. else
  20. G1-=g;
  21. if(B1<B2)
  22. B1+=b;
  23. else
  24. B1-=b;
  25. cout<<R1<<", "<<G1<<", "<<B1<<'\n';
  26. }
  27. cout<<R2<<", "<<G2<<", "<<B2<<'\n';
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement