Advertisement
EWTD

Untitled

Sep 29th, 2020
1,612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3.  
  4.  
  5. int main(){
  6.     int n;
  7.     scanf("%d",&n);
  8.     short value[2];
  9.     short state = 0;
  10.     scanf("%hd",&value[0]);
  11.     if(n == 1 && value[0] == 0){
  12.         printf("1");
  13.         return 0;
  14.     }
  15.     while( state == 0 && 1 == scanf("%hd",&value[1])){
  16.         if(value[0] == 0 && value[1] == 0){
  17.             printf("1 0 ");
  18.             state = 1;
  19.             continue;
  20.         }
  21.         printf("0 ");
  22.         value[0] = value[1];
  23.     }
  24.     if(state == 1){
  25.         while(1 == scanf("%hd",&value[0])){
  26.             printf("%hd ",value[0]);
  27.         }
  28.     }else{
  29.         printf("0 1 ");
  30.     }
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement