-
Notifications
You must be signed in to change notification settings - Fork 0
/
1050.php
34 lines (26 loc) · 881 Bytes
/
1050.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
// beecrowd | 1050
// DDD
// Adapted by Neilor Tonin, URI Brazil
// Timelimit: 1
// Read an integer number that is the code number for phone dialing. Then, print the destination according to the following table:
// If the input number isn’t found in the above table, the output must be:
// DDD nao cadastrado
// That means “DDD not found” in Portuguese language.
// Input
// The input consists in a unique integer number.
// Output
// Print the city name corresponding to the input DDD. Print DDD nao cadastrado if doesn't exist corresponding DDD to the typed number.
$x = trim(fgets(STDIN));
$ddd = [
61 => 'Brasilia',
71 => 'Salvador',
11 => 'Sao Paulo',
21 => 'Rio de Janeiro',
32 => 'Juiz de Fora',
19 => 'Campinas',
27 => 'Vitoria',
31 => 'Belo Horizonte',
];
$return = $ddd[$x] ?? "DDD nao cadastrado";
echo $return."\n";