Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. bool napok[365];
  4. int j,n,a,db;
  5. int main()
  6. {
  7. cin>>n;
  8. for(int i=1;i<=n;i++)
  9. {
  10. cin>>a;
  11. if(napok[a]==0)
  12.     {
  13.     cout<<i<<" "<<a<<endl;
  14.     napok[a]=1;
  15.     }
  16. else
  17. {
  18.     j=a;
  19.     while(j>=1)
  20.     {
  21.     if(napok[j]==0)
  22.     {
  23.     cout<<i;
  24.     napok[j]=1;
  25.     j=0;//kilép a while cikluisból
  26.     }
  27. j--;
  28.     }
  29. }
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement