diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2011-04-16 01:01:06 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2011-04-16 01:01:06 +0300 |
| commit | bb5a25946ea31a8d2a109f2516a1ddc45c62ceef (patch) | |
| tree | 46c54241e827d869163ceb508f157177dfcc336e /2010 | |
| parent | 081b15824663b9a6e74b31da236522ed69df8499 (diff) | |
fixed drop row logic
Diffstat (limited to '2010')
| -rw-r--r-- | 2010/1a/1.out | 6 | ||||
| -rw-r--r-- | 2010/1a/a.py | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/2010/1a/1.out b/2010/1a/1.out index 3da5a6f..1f26e7a 100644 --- a/2010/1a/1.out +++ b/2010/1a/1.out @@ -7,11 +7,11 @@ RB..... BRB.... RBBR... Case #2: -R..... -BRRR.. ...... +R..... BR.... -BBB... +BRR... +BBBR.. BRBR.. Case #3: .... diff --git a/2010/1a/a.py b/2010/1a/a.py index e96a53e..c3f6aab 100644 --- a/2010/1a/a.py +++ b/2010/1a/a.py @@ -8,11 +8,7 @@ def rotate(m): # drop a single row def droprow(r): - n = len(r) - for i in range(n)[::-1]: - if r[i] != '.': - return r[i+1:]+r[:i+1] - return r + return '.' * r.count('.') + r.replace('.','') # drop the rotated matrix def gravity(m): |
