ACM寒假集训2019.1.23
程序员文章站
2024-03-20 13:33:58
...
题目链接:https://vjudge.net/contest/279629#problem
代码:
#include <iostream>
using namespace std;
int main()
{
int n,sum=0;
cin >> n;
if (n < 2 || n>30)
return 0;
int *h = new int[n];
int *a = new int[n];
for (int i = 0; i < n; i++)
{
cin >> h[i] >> a[i];
if (h[i] < 1 || h[i]>100 ||h[i]==a[i]|| a[i] < 1 || a[i]>100)
return 0;
}
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (h[i] == a[j])
sum++;
cout << sum;
}
上一篇: ACM寒假集训2019.1.22
下一篇: cookies