该问题来自社区帖: https://bbs.csdn.net/topics/617826672.为符合问答规范, 该问题经过ChatGPT优化
<html><body>
<html><body>
Codeforces Round 891 (Div. 3) F|“朝闻道”知识分享大赛
这是我参加朝闻道知识分享大赛的第29篇文章.
x+y=a, xy=b 可以转换为二元一次方程 x^2-ax+b=0,解方程就行
第一发交,cf居然提示我哪里可能错了,真的哭死,要是自己找错肯定又要找半天T.T,最近总是乘法爆long long爆 int
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define _cf() int _;cin>>&_;while(_--)
const int N = 2e6;
const int inf = 2147483647;
void Solve()
{
int n;
cin>>&n;
ll x;
map vis;
for(int i=1;i<=n;i++) cin>>&x,vis[x]++;
int m;cin>>&m;
long double a,b;
while(m--)
{
ll res=0;
cin>>&a>>&b;
long double x1=(a+sqrt(a*a-4*b))/2;
long double x2=(a-sqrt(a*a-4*b))/2;
if(x1==(int)x1)
{
int y1=a-x1;
if(x1==y1) res+=vis[x1]*(vis[x1]-1)/2;
else res+=vis[x1]*vis[y1];
}
if(x1!=x2&&x2==(int)x2)
{
int y2=a-x2;
if(y2!=x1){
if(x2==y2) res+=vis[x2]*(vis[x2]-1)/2;
else res+=vis[x2]*vis[y2];
}
}
cout<</body></html>