No.2052 Indegree
レベル :
/ AI推定難易度 : 115
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 134
作問者 :
PCTprobability
/ テスター :
butsurizuki
タグ : / 解いたユーザー数 134
作問者 :
PCTprobability
/ テスター :
butsurizuki
問題文最終更新日: 2022-08-20 22:51:33
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
NPCA 合宿コンテスト
(順位表)
の他の問題:
Problem Statement
You are given a directed graph $G$ with $N$ vertices and $M$ edges. The $i$-th edge goes from vertex $A_i$ to vertex $B_i$.
Find the number of vertices of $G$ whose indegree is $0$.
Constraints
- $1 \le N,M \le 100$
- $1 \le A_i,B_i \le N$
- All input values are integers.
Input
$N$ $M$ $A_1$ $B_1$ $A_2$ $B_2$ $\vdots$ $A_M$ $B_M$
Output
Output the answer.
Sample
Sample 1
Input
3 2 1 2 3 2
Output
2
Vertices $1,3$ have indegree $0$ and vertex $2$ has indegree $2$, so the answer is $2$.
Sample 2
Input
1 1 1 1
Output
0
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。