#include <stdio.h> int main () { int n = 0; int m = 0; int d = 0; scanf("%d", &n); scanf("%d", &m); scanf("%d", &d); int tab[200002]; for (int i = 0; i < 200002; i++) { tab[i] = 0; } int tmp = 0; int tmp1 = 0; int tmp2 = 0; for (int i = 0; i < m; i++) { scanf("%d", &tmp); scanf("%d", &tmp1); tab[tmp] = tab[tmp] + 1; tab[tmp1] = tab[tmp1] + 1; } for (int i = 1; i <= n; i++) { if (tab[i] >= d) { tmp2 = tmp2 + 1; } } if (tmp2 >= 3) { printf("%d\n",tmp2); for (int i = 1; i <= n; i++) { if (tab[i] >= d) { printf("%d ",i); } } } else printf("NIE"); printf("\n"); }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #include <stdio.h> int main () { int n = 0; int m = 0; int d = 0; scanf("%d", &n); scanf("%d", &m); scanf("%d", &d); int tab[200002]; for (int i = 0; i < 200002; i++) { tab[i] = 0; } int tmp = 0; int tmp1 = 0; int tmp2 = 0; for (int i = 0; i < m; i++) { scanf("%d", &tmp); scanf("%d", &tmp1); tab[tmp] = tab[tmp] + 1; tab[tmp1] = tab[tmp1] + 1; } for (int i = 1; i <= n; i++) { if (tab[i] >= d) { tmp2 = tmp2 + 1; } } if (tmp2 >= 3) { printf("%d\n",tmp2); for (int i = 1; i <= n; i++) { if (tab[i] >= d) { printf("%d ",i); } } } else printf("NIE"); printf("\n"); } |