tyty68ty
幼苗
共回答了28个问题采纳率:85.7% 举报
选做内容也给你做了,给我加分不?:)
VC++2008下编译运行通过,输入输出格式都是n,c1,e1,c2,e2……
#include
#include
#include
using namespace std;
typedef map PnType;
void readPn(PnType &pn)
{
int n,c,e;
scanf("%d",&n);
while (n--) {
scanf(",%d,%d",&c,&e);
pn[e] = c;
}
}
void writePn(const PnType &pn)
{
cout second;
}
void mulPn(const PnType &a,const PnType &b,PnType &c)
{
c.clear();
for (PnType::const_iterator it1 = a.begin(); it1 != a.end(); ++it1)
for (PnType::const_iterator it2 = b.begin(); it2 != b.end(); ++it2)
c[it1->first + it2->first] += it1->second * it2->second;
}
int calcX1(const PnType &a)
{
int n=0;
for (PnType::const_iterator it = a.begin(); it != a.end(); ++it)
n += it->second;
return n;
}
void main()
{
PnType A,B,C;
cout
1年前
7