[PYTHON] yukicoder contest 264 entry record

yukicoder contest 264 entry record

A 1217 Sesuseso

Just go around the loop, find the unmatched indexes, and print XtoY.

S = input()

for i in range(26):
    a = chr(i + ord('a'))
    if S[i] == a:
        continue
    print('%sto%s' % (a, S[i]))
    break

B 1218 Something Like a Theorem

Even if I searched all over without thinking about anything, it didn't become TLE, and that was it.

n, z = map(int, input().split())

for x in range(1, z + 1):
    for y in range(x, z + 1):
        if x ** n + y ** n == z ** n:
            print('Yes')
            exit()
print('No')

C 1219 Mancala Combo

As an operation, A i </ sub> = i on the far left is operated and repeated, but of course if you implement it naively to simulate it, it will be TLE (Note that it is implemented with heapq and experienced Orz). If you think about it carefully, add up the number of times you erased A i + 1 </ sub> to A N </ sub> to the right of A i </ sub>. Therefore, when the stacking is c, c + A i </ sub> should be a multiple of i. When scanning from the right while stacking c, * O * (* N *) is displayed. Can be solved.

N, *A = map(int, open(0).read().split())

c = 0
for i in range(N - 1, -1, -1):
    if (A[i] + c) % (i + 1) != 0:
        print('No')
        break
    c += (A[i] + c) // (i + 1)
else:
    print('Yes')

Recommended Posts

yukicoder contest 256 entry record
yukicoder contest 267 entry record
yukicoder contest 264 entry record
yukicoder contest 245 entry record
yukicoder contest 250 entry record
yukicoder contest 262 entry record
yukicoder contest 265 Participation record
yukicoder contest 263 Participation record
yukicoder contest 243 Participation record
yukicoder contest 273 Participation record
yukicoder contest 252 Participation record
yukicoder contest 259 Participation record
yukicoder contest 249 Participation record
yukicoder contest 271 Participation record
yukicoder contest 251 Participation record
yukicoder contest 242 Participation record
yukicoder contest 241 Participation record
yukicoder contest 277 Participation record
yukicoder contest 257 Participation record
yukicoder contest 254 Participation record
yukicoder contest 246 Participation record
yukicoder contest 275 Participation record
yukicoder contest 274 Participation record
yukicoder contest 247 Participation record
yukicoder contest 261 Participation record
yukicoder contest 278 Participation record
yukicoder contest 248 Participation record
yukicoder contest 270 (mathematics contest) Participation record
yukicoder contest 272 (Weird math contest) Participation record
yukicoder contest 259 Review
yukicoder contest 264 Review
yukicoder contest 261 Review
yukicoder contest 267 Review
yukicoder contest 266 Review
yukicoder contest 263 Review
yukicoder contest 268 Review