Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool napok[365];
- int j,n,a,db;
- int main()
- {
- cin>>n;
- for(int i=1;i<=n;i++)
- {
- cin>>a;
- if(napok[a]==0)
- {
- cout<<i<<" "<<a<<endl;
- napok[a]=1;
- }
- else
- {
- j=a;
- while(j>=1)
- {
- if(napok[j]==0)
- {
- cout<<i;
- napok[j]=1;
- j=0;//kilép a while cikluisból
- }
- j--;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement