• [L] The battle of Red Cliff

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Zero loves palying Sanguo game very much, The battle of Red Cliff is one of scenes. Now he will put a fire to one of ships. Some ships are connected, some are not.Now, zero puts his fire, please tell him how many ships will be left.

  • 输入
  • Input until EOF.
    There are two positive integers N(2<N<100) and M(0<M<100), N means the number of ships, M means the number of command.
    Then M lines follows. Each line has two positive integers x and y means he will connect these two ships by a rope.
    Last line will include a number of ship's that zero will burn.
  • 输出
  • The ship's number is from 1 N, every ship which is connected a burning ship will also be burned.Now, please tell zero how many ships will be left.
  • 样例输入
  • 10 5
    1 2
    1 3
    1 4
    1 5
    1 6
    1
    5 2
    1 2
    1 3
    2
    
  • 样例输出
  • 4
    2
    
  • 提示
  • 来源
  • hungar
  • 操作

显示春菜