http://codeforces.com/contest/538A. Cutting Banner
s=raw_input()
flag = 0
for i in range(len(s)):
for j in range(i, len(s)):
if(s[:i]+s[j+1:] == 'CODEFORCES'):
flag = 1
if(flag==1):
print 'YES'
else:
print 'NO'
B. Quasi Binary
n = input()
ans = []
while n > 0 :
tmp = n
i = 0
y = 1
res = 0
while tmp > 0:
x = tmp%10
tmp /= 10
if x > 0:
res += y
y *= 10
n -= res
ans.append(res)
print len(ans)
print ' '.join(map(str, ans))
C. Tourist's Notes
n, m = map(int, raw_input().split())
pd, ph = map(int, raw_input().split())
ans = ph+pd-1
for i in range(m-1):
d, h = map(int, raw_input().split())
xd = d-pd
xh = abs(h-ph)
if xh > xd:
print 'IMPOSSIBLE'
exit()
tmp = (d-pd+h+ph)/2
ans = max(ans, tmp)
pd = d
ph = h
ans = max(ans, ph+n-pd)
print ans
D. Weird Chess以下用的是python超时代码,改成c++就能过。。。思路没问题枚举每一个位置,判断是否需要放‘x’,如果相对于每一个o,没有一个‘x’,那就不需要,如果其中一个是‘x’,那就需要把他变成‘x’,最后在判断是否合法即可。。。
n = input()
mp = []
a = []
b = []
for i in range(n):
s = raw_input()
for j, ch in enumerate(s):
if ch == 'o':
a.append((i,j))
mp.append(s)
ans = [['.' for i in range(2*n-1)] for i in range(2*n-1)]
ans2 = [['.' for i in range(n)] for i in range(n)]
tmp = 0
l = len(a)
for i in range(2*n-1):
for j in range(2*n-1):
sum1 = 0
for oo in a:
tx = oo[0]+(i+1-n)
ty = oo[1]+(j+1-n)
if tx<0 or tx>=n or ty<0 or ty>=n :
sum1 += 1
continue
elif mp[tx][ty] == 'o' or mp[tx][ty] == 'x':
sum1 = sum1+1
else:
break
if sum1 == l:
b.append((i,j))
ans[i][j] = 'x'
for pp in b:
for oo in a:
tx = oo[0]+(pp[0]+1-n)
ty = oo[1]+(pp[1]+1-n)
if tx<0 or tx>=n or ty<0 or ty>=n :
continue
ans2[tx][ty] = 'x';
for i in range(n):
for j in range(n):
if mp[i][j] == 'o' or ans2[i][j] == 'o':
continue
if mp[i][j] != ans2[i][j]:
tmp = 1
break
if tmp:
print 'NO'
else:
ans[n-1][n-1] = 'o'
print 'YES'
for i in range(2*n-1):
print ''.join(ans[i])
E. Demiurges Play Again树形DPF. A Heap of Heaps矩阵快速幂