PAT-甲级1002
来源:互联网 发布:linux服务器监听端口 编辑:程序博客网 时间:2024/06/01 09:52
传送门
#include <iostream>#include <vector>#include <string.h>using namespace std;struct Polynomials{int exponents;double coefficients;Polynomials(int exponents,double coefficients){this->exponents=exponents;this->coefficients=coefficients;}};const int MAX=1001;double array[MAX];int main(int argc,char **argv){int N,K;double C;memset(array,0,sizeof(array));cin>>N;for(int i=0;i<N;i++){cin>>K>>C;array[K]=C;}cin>>N;for(int i=0;i<N;i++){cin>>K>>C;array[K]+=C;}vector<Polynomials> src;for(int i=0;i<MAX;i++)if(array[i]!=0){Polynomials temp(i,array[i]);src.push_back(temp);}cout<<src.size();for(auto it=src.rbegin();it!=src.rend();it++)printf(" %d %.1f",(*it).exponents,(*it).coefficients);cout<<endl;return 0;}
0 0
- PAT-甲级1002
- PAT甲级1002
- PAT甲级习题(1002)
- PAT-甲级-1002
- PAT甲级1002
- PAT甲级1001,1002
- PAT甲级 1002
- PAT甲级1002题解
- PAT甲级1002
- 浙大PAT甲级-1002
- PAT甲级 1002
- 【PAT】甲级1002
- PAT 甲级练习 1002
- pat甲级1002
- Pat甲级1002 in Python
- PAT甲级1002 A + B
- PAT 甲级
- PAT甲级1002-写出这个数
- TabeViewCell多选
- 整合大量开源库温习基础项目(二)顺便再提提单例模式
- #pragma pack(1) 的用法 强制单字节对齐
- GenyMotion 一直停在开机画面
- [Cloud Networking Notes] Management and sharing of network infrastructure in cloud data centers
- PAT-甲级1002
- Boost源码学习三[实用工具](2)
- ListView中的滚动事件及自动翻页功能
- 1055. The World's Richest (25)
- iOS 用NSAttributedString处理文字大小不一致情况
- redis conf配置文件详解
- 【Hours】使用indexedDB中遇到的问题。
- 初步体验libsvm用法3(matlab实例)
- 关于垂直切分Vertical Sharding的粒度