제출 #124712

#제출 시각아이디문제언어결과실행 시간메모리
124712wilwxkNetwork (BOI15_net)C++14
0 / 100
13 ms12152 KiB
#include <bits/stdc++.h>
using namespace std;

const int MAXN=5e5+5;
vector<int> g[MAXN];
int n;

int main() {
	scanf("%d", &n);
	for(int i=1; i<=n-1; i++) {
		int a, b; scanf("%d %d", &a, &b);
		g[a].push_back(b); g[b].push_back(a);
	}

	int cont=0;
	for(int i=1; i<=n; i++) if(g[i].size()==1) cont++;

	printf("%d\n", (cont+1)/2);
}

컴파일 시 표준 에러 (stderr) 메시지

net.cpp: In function 'int main()':
net.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
net.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d %d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...