ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 2023. Donald is a postman

Python2.7 WA#4 what problem, help please?
Posted by Salavat 8 Aug 2018 19:49
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from itertools import count

mailBox = {"Alice": 1, "Ariel": 1, "Aurora": 1,"Phil": 1, "Peter": 1,"Olaf": 1,"Phoebus": 1, "Ralph": 1, "Robin": 1,
"Bambi": 2, "Belle": 2,"Bolt": 2, "Mulan": 2,"Mowgli": 2,"Mickey": 2,"Silver": 2,"Simba": 2,"Stitch": 2,
"Dumbo": 3, "Genie": 3,"Jiminy": 3, "Kyzko": 3,"Kida": 3,"Kenai": 3,"Tarzan": 3,"Tiana": 3,"Winnie": 3,
}

# кол-во писем
n = int(raw_input())
# list с именами адресатов
inputMailFrom = []
# цикл по заполению адресатов
for n in range(n):
inputMailFrom.append(mailBox.get(raw_input()))
step = []

if len(inputMailFrom) == 1:
if  inputMailFrom[0] == 1:
print (0)
if inputMailFrom[0] == 2:
print (1)
if inputMailFrom[0] == 3:
print (2)
else:
for i in range(n):
step.append(abs(inputMailFrom[i]-inputMailFrom[i+1]))
print (sum(step)
Re: Python2.7 WA#4 what problem, help please?
Posted by Pearl 2 Oct 2018 09:27
Try this
2
Tiana
Aurora