AcWing 671. DDD - Java
原题链接
简单
作者:
KYCygni
,
2021-03-09 13:59:19
,
所有人可见
,
阅读 327
Java 代码
import java.util.Scanner;
import java.util.HashMap;
public class Main
{
public static void main (String[] args)
{
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
HashMap m = new HashMap();
m.put(61, "Brasilia");
m.put(71, "Salvador");
m.put(11, "Sao Paulo");
m.put(21, "Rio de Janeiro");
m.put(32, "Juiz de Fora");
m.put(19, "Campinas");
m.put(27, "Vitoria");
m.put(31, "Belo Horizonte");
if (m.containsKey(n))
System.out.println ( m.get(n));
else
System.out.println ("DDD nao cadastrado");
}
}