3ç´ã«ãªã£ã¦ããã
ä¾ã®ãã¨ãAã¨Bã ã解ãã¦Cã¯WAã
Cåé¡ã解ããªã(´ã»Ïã»ï½)
A: 週末 - AtCoder Regular Contest #012 | AtCoder
åæ¥ã¾ã§ã®æ¥æ°ãæ±ããããã ãåæ¥ãå
¥åã¨ãã¦ä¸ããããå ´åã¯0ãè¿ãã
ããã ã
# -*- coding: utf-8 -*- import sys import collections day = raw_input().strip() days = ['Saturday', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'] i = days.index(day) if i > 1: print (7 - days.index(day)) % 7 else: print 0
B: アキレスと亀 - AtCoder Regular Contest #012 | AtCoder
ã¢ãã¬ã¹ã¨äºã®è©±ãnåãã£ãã¨ãã®è·é¢ãæ±ããã
ããã ãã
# -*- coding: utf-8 -*- import math import sys import datetime N, va, vb, L = map(int, raw_input().split()) d = float(L) for i in xrange(N): t = d / va d = vb * t print '{:.10f}'.format(d)
C: 五目並べチェッカー - AtCoder Regular Contest #012 | AtCoder
äºç®ä¸¦ã¹ã®ç¤é¢ã¨ãã¦æ£ãããã©ãããæ±ããã
åé¡æã¨ãµã³ãã«ãä¸è´ãã¦ãªããããªæ°ããããã¨ããããé©å½ã«å®è£ ã
å ´ååãã®ä¸é¨ãå¿ãã¦WA
æ¹éã¨ãã¦ã¯ã¾ãç³ã®åæ°ãæããã«ããããã®ãé¤ãã
10å以ä¸ä¸¦ãã§ããå ´åã¯ãã¡ã
5ã¤ä»¥ä¸ã®ç³ã®åã«å¯¾ãã交差ç¹ã2ç®æ以ä¸ããã¨ãã¡ã
åããã¬ã¤ã¤ã¼ã®5å以ä¸ä¸¦ãã§ããåãã交差ããã«äºç®æ以ä¸ãã£ãããã¡ã
ã¨ããã®ã延ã
ã¨å®è£
ãããã²ã©ãæ±ãã³ã¼ãã«ãªã£ãorz
ããããå ´åã£ã¦ã©ããã£ãã綺éºã«æ¸ãããã§ãããï¼
åèã«ãªããããªãã¤ã¼ããè¦ã¤ãã
#atcoder Python 㧠W*H ã®ç¤é¢ãæååã1次å é åã§è¡¨ãå ´åã横äºåé£ç¶ B[i:i+5]=='o'*5 ã§ãåããå³æãä¸ã¯ B[i::W+1][:5] ã®ããã«æ¥½ã«ãã§ãã¯ã§ããããã ãå·¦å³ã®åãè¾¼ã¿ãããã®ã§ãå³ç«¯ã左端ã«çªå µç½®ãã¦Wã+1ãã¦ããã
2013-02-10 21:43:08 via web
ãããã交差ããç¹ãåã
ã®é£ç¶ããç³ã®ç«¯ãã5çªç®ã¾ã§ã®è·é¢ã«ãããã©ããã¨ããæ¡ä»¶ãå¿ãã¦ããã®ã§ãéãã¯ãããªãã£ãâ¦â¦ã
ä»ã«ãè¦è½ã¨ãããããããããªãã
以ä¸éããªãã½ã¼ã¹ã³ã¼ãã
# -*- coding: utf-8 -*- import math import sys import collections stage = [] for line in sys.stdin: stage.append(line.strip()) count_x = 0 count_o = 0 S = len(stage) L = len(stage[0]) check = [[0 for i in xrange(L)] for j in xrange(S)] for i, s in enumerate(stage): for j, c in enumerate(s): if c == 'x': count_x += 1 check[i][j] = -1 elif c == 'o': count_o += 1 check[i][j] = 1 win_o = False win_x = False check_yoko = [[0 for i in xrange(L)] for j in xrange(S)] check_tate = [[0 for i in xrange(L)] for j in xrange(S)] check_mnaname = [[0 for i in xrange(L)] for j in xrange(S)] check_hnaname = [[0 for i in xrange(L)] for j in xrange(S)] if count_o >= count_x and count_o - count_x < 2: for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 for k in xrange(j, L): if cur != check[i][k]: break else: count += 1 if count >= 10: print 'NO' sys.exit(0) elif 5 <= count <= 9: for k in xrange(j, j + count): check_yoko[i][k] = 1 if cur == -1: win_x = True else: win_o = True for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 for k in xrange(i, S): if cur != check[k][j]: break else: count += 1 if count >= 10: print 'NO' sys.exit(0) elif 5 <= count <= 9: for k in xrange(i, i + count): check_tate[k][j] = 1 if cur == -1: win_x = True else: win_o = True for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 for k in xrange(min(S - i, L - j)): if cur != check[i + k][j + k]: break else: count += 1 if count >= 10: print 'NO' sys.exit(0) elif 5 <= count <= 9: for k in xrange(count): check_mnaname[i][j] = 1 if cur == -1: win_x = True else: win_o = True for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 for k in xrange(min(i + 1, L - j)): if cur != check[i - k][j + k]: break else: count += 1 if count >= 10: print 'NO' sys.exit(0) elif 5 <= count <= 9: for k in xrange(count): check_hnaname[i][j] = 1 if cur == -1: win_x = True else: win_o = True test = 0 for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 count_check = 0 for k in xrange(j, L): if cur != check[i][k]: break else: count += 1 if check_tate[i][k] == 1 or check_mnaname[i][k] == 1 or check_hnaname[i][k] == 1: count_check += 1 if 5 <= count <= 9: if count_check >= 2: print 'NO' sys.exit(0) elif count_check == 0: test += 1 for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 count_check = 0 for k in xrange(i, S): if cur != check[k][j]: break else: count += 1 if check_yoko[k][j] == 1 or check_mnaname[k][j] == 1 or check_hnaname[k][j] == 1: count_check += 1 if 5 <= count <= 9: if count_check >= 2: print 'NO' sys.exit(0) elif count_check == 0: test += 1 for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 for k in xrange(min(S - i, L - j)): if cur != check[i + k][j + k]: break else: count += 1 if check_yoko[i + k][j + k] == 1 or check_tate[i + k][j + k] == 1 or check_hnaname[i + k][j + k] == 1: count_check += 1 if 5 <= count <= 9: if count_check >= 2: print 'NO' sys.exit(0) elif count_check == 0: test += 1 for i in xrange(S): for j in xrange(L): if abs(check[i][j]) == 1: cur = check[i][j] count = 0 for k in xrange(min(i + 1, L - j)): if cur != check[i - k][j + k]: break else: count += 1 if check_yoko[i - k][j + k] == 1 or check_tate[i - k][j + k] == 1 or check_mnaname[i - k][j + k] == 1: count_check += 1 if 5 <= count <= 9: if count_check >= 2: print 'NO' sys.exit(0) elif count_check == 0: test += 1 if test > 1: print 'NO' sys.exit(0) if win_o and win_x: print 'NO' elif not win_o and not win_x: print 'YES' elif win_o: if count_o > count_x: print 'YES' else: print 'NO' elif win_x: if count_o == count_x: print 'YES' else: print 'NO' else: print 'NO'