paizaãã¤ã©ã¹ãä»ãã§ããã°ã©ãã³ã°ã®åé¡ãåºãã¦ããpaizaãªã³ã©ã¤ã³ããã«ã½ã³ã5åç®ã«ãªãã¾ãã
ååãããããé£æ度ãä¸ãã£ã代ããã«ãã¤ã©ã¹ãã¨ãã¹ãã¼ãªã¼ã¨ãã«åã注ãå§ãã¦ããã¿ããã§ã(ï¼)
ãªãã¨ã¹ãã¼ãªã¼ã®åå²ãããã¾ãpaiza.jp
ååâã¯ç°¡åã ã£ãã®ã§Pythonã¯ã³ã©ã¤ãã¼ã«ææ¦ãã¾ãã
ãã£ãããªã®ã§ä»åãã¯ã³ã©ã¤ãã¼ã®ã³ã¼ããæ¸ãã¾ããsucrose.hatenablog.com
ä¸è¨ã®ã¾ã¨ããè¦ãã¨ã¯ã³ã©ã¤ãã¼ã§è§£ãã¦ããbashã§è§£ãã¦ãããããããªäººãããã¿ããã§ãpaiza.hatenablog.com
1åç®
å¶æ°çªç®ã®æåãåºåããã ã
print raw_input()[::2]
2åç®
7ã®åæ°ã®åæ°ã®è¦ç´ ãä¸ããããã®ã§ãæ·»åã7ã§å²ã£ããã¾ããçããã°ã«ã¼ããã¨ã«ããããã®ç·åãæ±ãã
n = input() data = [input() for i in xrange(n)] for i in xrange(7): print sum(data[i::7])
ã¯ã³ã©ã¤ãã¼ç
iterã¨zipããã¾ã使ãã¨æ¥½ã«æ¸ãã¾ã
print '\n'.join([str(sum(s)) for s in zip(*zip(*7 * [iter([input() for i in range(input())])]))])
3åç®
ã©ã£ã¡ã®ãã£ã©ã®åå²ã«é²ãããåºåããã ã
4åç®A
2次å
ã®è½ã¡ãã®ããºã«ã®ç¤é¢ãèãã
ç¾å¨ã®ç¤é¢ã¨æ¬¡ã«æ¶ããé¨åãä¸ããããã®ã§è½ä¸å¾ã®ç¤é¢ãçãã
æ¶ããªããã®ã®åæ°ãæ°ãã¦ä¸ããç©ãã§ããã ã
x, y = map(int, raw_input().split()) field = [] for i in xrange(y): field.append(map(int, raw_input().split())) new_field = [['0'] * x for i in xrange(y)] for j in xrange(x): count = 0 for i in xrange(y - 1, -1, -1): if field[i][j] == 1: count += 1 new_field[y - count][j] = '1' for i in xrange(y): print ' ' .join(new_field[i])
print '\n'.join([' '.join(i) for i in zip(*[('1' * sum(map(lambda x: x==1, i))).zfill(len(i)) for i in zip(*[map(int, raw_input().split()) for i in xrange(map(int, raw_input().split())[1])])])])
4åç®B
æ°å¤ã®2次å
é
åãä¸ãããã
é·æ¹å½¢ã®ç¯å²ãè¤æ°ä¸ããããã®ã§ã2次å
é
åã®ä¸ã§ãã®ããããã®é·æ¹å½¢ã«å«ã¾ããæ°å¤ã®åè¨ãçãã
æåã«ãå«ã¾ããç¯å²ã ãå¥ã®é åã«æ¸ãåºãã¦ãã§ãã¯ãã
x, y, N = map(int, raw_input().split()) cell = [] for i in xrange(y): cell.append(map(int, raw_input().split())) mask = [[1] * x for i in xrange(y)] for i in xrange(N): x1, y1, x2, y2= map(int, raw_input().split()) for j in xrange(x1 - 1, x2): for k in xrange(y1 - 1, y2): mask[k][j] = 0 print sum([cell[i][j] for i in xrange(y) for j in xrange(x) if mask[i][j] == 0])
ã¯ã³ã©ã¤ãã¼ç
ä¸ã®ã³ã¼ãã¨ã¯éã£ã¦æç´ã«æ¯åç¯å²ã®æ¡ä»¶ãå¤å®ãã¦ãã¾ã
x, y, N = map(int, raw_input().split()); cell = [map(int, raw_input().split()) for j in range(y)]; print sum([max(i) for i in zip(*[[cell[i][j] if x1 - 1 <= j <= x2 - 1 and y1 - 1 <= i <= y2 - 1 else 0 for i in xrange(y) for j in xrange(x)] for x1, y1, x2, y2 in [map(int, raw_input().split()) for k in xrange(N)]])])