zoukankan      html  css  js  c++  java
  • PAT 甲级 1009 Product of Polynomials

    https://blog.csdn.net/a845717607/article/details/86530433

    map使用:

    声明:map<键,值> 变量名;

    存储:

    1. scanf("%d %lf",&e,&coe);
    2.  mp1[e]=coe;

    遍历:for(map<int,double>::iterator it=mp1.begin();it!=mp1.end();++it) 

    逆序遍历:for(map<int,double>::reverse_iterator it=mp2.rbegin();it!=mp2.rend();++it)

    PS.

    1. map内部自建一颗红黑树(一 种非严格意义上的平衡二叉树),这颗树具有对数据自动排序的功能,所以在map内部所有的数据都是有序的。
    2. 注意进位
    if(mp2.count(it->first+e)==0)
                    mp2[it->first+e]=it->second*coe;
                else
                    mp2[it->first+e]+=it->second*coe;
  • 相关阅读:
    归并排序
    快速排序
    希尔排序
    插入排序
    选择排序
    冒泡排序
    排序算法
    Win10 家庭版升级到专业版报错
    WPF 原生Style
    在线图片转换
  • 原文地址:https://www.cnblogs.com/jeseesmith/p/13903199.html
Copyright © 2011-2022 走看看