回答編集履歴
4
リファクタ
    
        answer	
    CHANGED
    
    | 
         @@ -13,11 +13,11 @@ 
     | 
|
| 
       13 
13 
     | 
    
         
             
            base_hour, base_minute = map(int, base_time.split(':'))
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            standard_hour = (base_hour - timezone_table[base_city]) % 24
         
     | 
| 
       16 
     | 
    
         
            -
            for  
     | 
| 
      
 16 
     | 
    
         
            +
            for diff in timezone_table.values():
         
     | 
| 
       17 
     | 
    
         
            -
                print(f'{(standard_hour +  
     | 
| 
      
 17 
     | 
    
         
            +
                print(f'{(standard_hour + diff) % 24:02d}:{base_minute:02d}')
         
     | 
| 
       18 
18 
     | 
    
         
             
            ```
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
            [Wandbox](https://wandbox.org/permlink/ 
     | 
| 
      
 20 
     | 
    
         
            +
            [Wandbox](https://wandbox.org/permlink/fvC7likOXLyuWNpt)
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            ---
         
     | 
| 
       23 
23 
     | 
    
         
             
            [datetimeモジュール](https://docs.python.jp/3/library/datetime.html)を使ってみた例。どっちもどっちですね。
         
     | 
3
リファクタ
    
        answer	
    CHANGED
    
    | 
         @@ -9,15 +9,15 @@ 
     | 
|
| 
       9 
9 
     | 
    
         
             
                city, diff = input().split()
         
     | 
| 
       10 
10 
     | 
    
         
             
                timezone_table[city] = int(diff)
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            base_city,  
     | 
| 
      
 12 
     | 
    
         
            +
            base_city, base_time = input().split()
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
            base_hour, base_minute = map(int, base_time.split(':'))
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
            standard_hour = (base_hour - timezone_table[base_city]) % 24
         
     | 
| 
       16 
16 
     | 
    
         
             
            for city, diff in timezone_table.items():
         
     | 
| 
       17 
     | 
    
         
            -
                print(f'{( 
     | 
| 
      
 17 
     | 
    
         
            +
                print(f'{(standard_hour + timezone_table[city]) % 24:02d}:{base_minute:02d}')
         
     | 
| 
       18 
18 
     | 
    
         
             
            ```
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
            [Wandbox](https://wandbox.org/permlink/ 
     | 
| 
      
 20 
     | 
    
         
            +
            [Wandbox](https://wandbox.org/permlink/Jw06bs2RkidFyqjd)
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            ---
         
     | 
| 
       23 
23 
     | 
    
         
             
            [datetimeモジュール](https://docs.python.jp/3/library/datetime.html)を使ってみた例。どっちもどっちですね。
         
     | 
2
追記
    
        answer	
    CHANGED
    
    | 
         @@ -20,4 +20,24 @@ 
     | 
|
| 
       20 
20 
     | 
    
         
             
            [Wandbox](https://wandbox.org/permlink/cWRKNntgSABzUL7q)
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            ---
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
      
 23 
     | 
    
         
            +
            [datetimeモジュール](https://docs.python.jp/3/library/datetime.html)を使ってみた例。どっちもどっちですね。
         
     | 
| 
      
 24 
     | 
    
         
            +
            ```Python
         
     | 
| 
      
 25 
     | 
    
         
            +
            from collections import OrderedDict
         
     | 
| 
      
 26 
     | 
    
         
            +
            from datetime import datetime, timedelta
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            n = int(input())
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            timezone_table = OrderedDict()
         
     | 
| 
      
 31 
     | 
    
         
            +
            for _ in range(n):
         
     | 
| 
      
 32 
     | 
    
         
            +
                city, diff = input().split()
         
     | 
| 
      
 33 
     | 
    
         
            +
                timezone_table[city] = timedelta(hours=int(diff))
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            base_city, base_time = input().split()
         
     | 
| 
      
 36 
     | 
    
         
            +
            base_time = datetime.strptime(base_time, '%H:%M')
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            standard_time = (base_time - timezone_table[base_city])
         
     | 
| 
      
 39 
     | 
    
         
            +
            for diff in timezone_table.values():
         
     | 
| 
      
 40 
     | 
    
         
            +
                print(datetime.strftime(standard_time + diff, '%H:%M'))
         
     | 
| 
      
 41 
     | 
    
         
            +
            ```
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            [Wandbox](https://wandbox.org/permlink/9A2bnhuRXjccu6M0)
         
     | 
1
修正
    
        answer	
    CHANGED
    
    | 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ちょっとだけ 
     | 
| 
      
 1 
     | 
    
         
            +
            ちょっとだけスマートにできた...かも。あんまり変わってないようにも見えます。
         
     | 
| 
       2 
2 
     | 
    
         
             
            ```Python
         
     | 
| 
       3 
3 
     | 
    
         
             
            from collections import OrderedDict
         
     | 
| 
       4 
4 
     | 
    
         |