SOCIAL SOLIDARITY STRUCTURES
Due to the expansion of the economic crisis and to prevent it from taking on characteristics of social disaster, institutions (educational and non-educational), non-governmental organizations, and hundreds of collectives across Greece are developing actions of social solidarity and protection. Exchange of goods and services, distribution of essential items, provision of health services, and educational support are some of the various actions being implemented in our area.
From the beginning, it became evident that these actions are more effective when they are well-coordinated and have a broader presence throughout Greece. A key lever for both is the connection and collaboration among solidarity structures. Students from a second chance school took the initiative to document existing structures and identify those connected to fewer than two other structures.
Problem
Develop a program in one of the IOI languages that, after reading a file containing the list of existing connections in a network of solidarity structures, returns the number of structures with fewer than two connections.
Input Files
The input file domes.in is a text file in the following format: The first line contains two integers, and , separated by a space. is the number of solidarity structures, numbered from to . is the number of connections that exist. Following are lines, each containing a pair of integers, and (, , and ), separated by a space. The pair , represents a bidirectional connection between structures and .
Output Files
The output file domes.out is a text file in the following format: It has only one line containing a single integer : the number of structures that have fewer than two connections.
Examples of Input - Output Files:
1st
STDIN (domes.in)
6 7
2 4
4 1
3 5
4 3
1 3
5 1
5 6
STDOUT (domes.out)
2
2nd
STDIN (domes.in)
7 9
5 7
4 2
3 6
2 3
1 7
6 2
4 6
1 5
3 4
STDOUT (domes.out)
0
Constraints:
Time Limit: 1sec.
Maximum Available Memory: 64MB.
Comments