Advertisement
kirya_shkolnik

Untitled

May 8th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. const int N=2020;
  6. int main(){
  7.     int a[N];
  8.     int i,m,k;
  9.     for(i=0; i<N; ++i){
  10.         cin >> a[i];
  11.     }
  12.     m=-1;
  13.     for(i=0; i<N; ++i){
  14.         if(a[i] % 2 != 0 and a[i] < 1000 and a[i] > m){
  15.             m = a[i];
  16.         }
  17.     }
  18.     k = 1000 / m;
  19.     if( k*m <= 1000 ) k++;
  20.     for(i=0; i<N; ++i){
  21.         if(a[i] % 2 != 0 and a[i] < 1000){
  22.             a[i] = a[i] * k;
  23.         }
  24.         cout << a[i] << " ";
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement