#define ll long long
#define fi first
#define se second
#include <bits/stdc++.h>
using namespace std;
int main(){
ll n,m,a,b,q,i,j;
vector<pair <double, pair<ll,ll> >> suhu;
cin>>n>>m>>a>>b>>q;
ll x,y; double suhuxy;
for(i=1; i<=n; i++){
for(j=1; i<=m; j++){
x = b + j;
y = a + i;
suhuxy = x/y;
suhu.push_back(suhuxy, (x,y));
}
}
return 0;
}
我尝试通过
double
函数输入一个ll
,一个ll
和另一个push_back()
。但是,它说这个错误:
prog.cpp:27:32: error: no matching function for call to ‘std::vector<std::pair<double, std::pair<long long int, long long int> > >::push_back(double&, long long int&)’
suhu.push_back(suhuxy, (x,y));
您的
vector
包含一个 pair
数组,所以这就是 push_back()
所期望的,但这不是您给它的。
试试这个:
suhu.push_back(make_pair(suhuxy, make_pair(x,y)));
或者:
suhu.push_back({suhuxy, {x,y}});