Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main(){
- int n;
- scanf("%d",&n);
- short value[2];
- short state = 0;
- scanf("%hd",&value[0]);
- if(n == 1 && value[0] == 0){
- printf("1");
- return 0;
- }
- while( state == 0 && 1 == scanf("%hd",&value[1])){
- if(value[0] == 0 && value[1] == 0){
- printf("1 0 ");
- state = 1;
- continue;
- }
- printf("0 ");
- value[0] = value[1];
- }
- if(state == 1){
- while(1 == scanf("%hd",&value[0])){
- printf("%hd ",value[0]);
- }
- }else{
- printf("0 1 ");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement