Skip to main content
Apply gnibbler's shortening
Source Link
Keith Randall
  • 21k
  • 2
  • 44
  • 105

Python, 194 177 176176 172 characters

f=open(raw_input())
V,H=map(int,next(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f):
 t=t[1:]+c;p+=1
 if'# '==t['in(t[-2:]or'# '==t[],t[::W]):print"%d\t%d\t%d"%(n,p/W,p%W);n+=1

Python, 194 177 176 characters

f=open(raw_input())
V,H=map(int,next(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f):
 t=t[1:]+c;p+=1
 if'# '==t[-2:]or'# '==t[::W]:print"%d\t%d\t%d"%(n,p/W,p%W);n+=1

Python, 194 177 176 172 characters

f=open(raw_input())
V,H=map(int,next(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f):
 t=t[1:]+c;p+=1
 if'# 'in(t[-2:],t[::W]):print"%d\t%d\t%d"%(n,p/W,p%W);n+=1
reorder condition to save a space
Source Link
Keith Randall
  • 21k
  • 2
  • 44
  • 105

Python, 194 177177 176 characters

f=open(raw_input())
V,H=map(int,next(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f):
 t=t[1:]+c;p+=1
 ifif'# t['==t[-2:]=='# 'or'#]or'# '==t[::W]:print"%d\t%d\t%d"%(n,p/W,p%W);n+=1

Python, 194 177 characters

f=open(raw_input())
V,H=map(int,next(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f):
 t=t[1:]+c;p+=1
 if t[-2:]=='# 'or'# '==t[::W]:print"%d\t%d\t%d"%(n,p/W,p%W);n+=1

Python, 194 177 176 characters

f=open(raw_input())
V,H=map(int,next(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f):
 t=t[1:]+c;p+=1
 if'# '==t[-2:]or'# '==t[::W]:print"%d\t%d\t%d"%(n,p/W,p%W);n+=1
apply suggestions
Source Link
Keith Randall
  • 21k
  • 2
  • 44
  • 105

Python, 194194 177 characters

f=open(raw_input())
V,H=map(int,f.readlinenext(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f.readlines()):
 t=t[1:]+c;p+=1
 if t[-2:]=='# 'or'# '==t[::W]:print"%d\t%d\t%d"%(n,p/W,p%W);n+=1

Python, 194 characters

f=open(raw_input())
V,H=map(int,f.readline().split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f.readlines()):
 t=t[1:]+c;p+=1
 if t[-2:]=='# 'or'# '==t[::W]:print"%d\t%d\t%d"%(n,p/W,p%W);n+=1

Python, 194 177 characters

f=open(raw_input())
V,H=map(int,next(f).split())
p=W=H+2
h='#'
t=W*h+h
n=1
for c in h.join(f):
 t=t[1:]+c;p+=1
 if t[-2:]=='# 'or'# '==t[::W]:print"%d\t%d\t%d"%(n,p/W,p%W);n+=1
Source Link
Keith Randall
  • 21k
  • 2
  • 44
  • 105
Loading