简单题
View Code
#include#include #include #include using namespace std;#define maxn 20int n;int f[maxn];void input(){ n = 0; while (scanf("%d", &f[n]), f[n]) { if (f[n] == -1) exit(0); n++; }}void work(){ int ans = 0; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (f[i] == f[j] * 2) ans++; printf("%d\n", ans);}int main(){ while (1) { input(); work(); }}