Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- int n;
- int v[10001];
- cin >> n;
- for(int i = 0; i < n; i++){
- cin >> v[i];
- if(v[i]==0)
- cout << "0\n";
- else{
- int j = -n;
- while(j < n){
- if(v[i]== -1 && i+j >= 0 && i+j <= n){
- v[i]=v[i+j];
- }
- if(v[i] != 0 ){
- j++;
- continue;
- }else{
- cout << j << "\n";
- }
- j++;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement