Advertisement
Guest User

Untitled

a guest
May 25th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package main
  2. import(
  3. "fmt"
  4. "os"
  5. "text/scanner"
  6. "strconv"
  7. )
  8. var sc scanner.Scanner
  9. func nextInt() int {
  10. sc.Scan()
  11. i, _ := strconv.Atoi(sc.TokenText())
  12. return i
  13. }
  14. func main(){
  15. sc.Init(os.Stdin)
  16. x := nextInt()
  17. y := nextInt()
  18. row := make([]int, x)
  19. for i := 0; i< y; i++{
  20. for j := 0 ; j < x; j++{
  21. tmp := nextInt()
  22. if tmp == 1{
  23. row[j] += 1
  24. }
  25. }
  26. }
  27. for i := 0; i< y; i++{
  28. for j := 0 ; j < x; j++{
  29. if row[j] > y - i - 1{
  30. fmt.Print(1)
  31. }else{
  32. fmt.Print(0)
  33. }
  34. if j < x - 1{
  35. fmt.Print(" ")
  36. }
  37. }
  38. fmt.Println()
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement