541

Error Correction
Type:
Matrix
Diff: 2.0

Tricks

The algorithm for solving this problem is as follows:

1.   Initialize array a[][] // read input

2.   x <- 0, y <-0, t<-0,

3.   for i =0 to n    // n is the dimension

4.               temp <-0

5.               for j =0 to n

6.                           temp += a[i,j]

7.               if temp is odd

8.                          if x != 0

9.                                      then x = i+1;

10.                        else print �Corrupt

11.                        t =0, x =0;

12.                        break

13. for j =0 to n && t = 1

14.             temp =0

15.             for j =0 to n

16.                        temp = temp + mat[i,j]

17.             if temp is odd

18.                        if x!=0 && y != 0

19.                        then y = j + 1

20.                         else print �Corrupt

21.                        t =0, y =0;

22.                        break

23. if x !=0 && y != 0

24. then print Change bit (2,3)

25. else print OK

Related Problems & Topics

 

If you have any advice, complements 

or proposal, please  Send mail to Author

Submit

 

1