PAT (Advanced Level) 1002. A+B for Polynomials (25)
为0的不要输出。
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std; double a[],b[];
int k; int main()
{
for(int i=;i<=;i++) a[i]=b[i]=;
int Max=-;
scanf("%d",&k);
for(int i=;i<=k;i++)
{
int id;double num;
scanf("%d%lf",&id,&num);
Max=max(Max,id);
a[id]=num;
} scanf("%d",&k);
for(int i=;i<=k;i++)
{
int id;double num;
scanf("%d%lf",&id,&num);
Max=max(Max,id);
b[id]=num;
} int cnt=;
for(int i=Max;i>=;i--)
if(a[i]+b[i]!=) cnt++; printf("%d",cnt);
int op=;
for(int i=Max;i>=;i--)
{
if(a[i]+b[i]!=){
printf(" %d %.1lf",i,a[i]+b[i]);
}
}
return ;
}
PAT (Advanced Level) 1002. A+B for Polynomials (25)的更多相关文章
- PTA (Advanced Level) 1002 A+B for Polynomials
1002 A+B for Polynomials This time, you are supposed to find A+B where A and B are two polynomials. ...
- PAT (Advanced Level) Practise - 1094. The Largest Generation (25)
http://www.patest.cn/contests/pat-a-practise/1094 A family hierarchy is usually presented by a pedig ...
- PAT (Advanced Level) 1102. Invert a Binary Tree (25)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- PAT (Advanced Level) 1098. Insertion or Heap Sort (25)
简单题.判断一下是插排还是堆排. #include<cstdio> #include<cstring> #include<cmath> #include<ve ...
- PAT (Advanced Level) 1067. Sort with Swap(0,*) (25)
只对没有归位的数进行交换. 分两种情况: 如果0在最前面,那么随便拿一个没有归位的数和0交换位置. 如果0不在最前面,那么必然可以归位一个数字,将那个数字归位. 这样模拟一下即可. #include& ...
- PAT (Advanced Level) 1066. Root of AVL Tree (25)
AVL树的旋转.居然1A了.... 了解旋转方式之后,数据较小可以当做模拟写. #include<cstdio> #include<cstring> #include<c ...
- PAT (Advanced Level) 1055. The World's Richest (25)
排序.随便加点优化就能过. #include<iostream> #include<cstring> #include<cmath> #include<alg ...
- PAT (Advanced Level) 1047. Student List for Course (25)
简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...
- PAT (Advanced Level) 1082. Read Number in Chinese (25)
模拟题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
随机推荐
- SUPERVISOR进程管理器配置指南
SUPERVISOR进程管理器配置指南1. supervisor简介1.1. 官网http://supervisord.org/ 1.2. 介绍Supervisor是一个进程控制系统. 它是一个C/S ...
- 好用的API文档--在线版
安卓在线api http://www.android-doc.com/reference/packages.html
- HP ProLiant DL380 G6 服务器 - 清 BIOS 的方法
问题 HP ProLiant DL380 G6服务器的BIOS位置在哪里? 如何清BIOS,具体步骤是什么? 解决方案 DL380 G6服务器清BIOS过程分为三步: 1. 为服务器断电(拔掉电源线) ...
- Django CRM学员系统项目
项目需求: 1.分讲师\学员\课程顾问角色,2.学员可以属于多个班级,学员成绩按课程分别统计3.每个班级至少包含一个或多个讲师4.一个学员要有状态转化的过程 ,比如未报名前,报名后,毕业老学员5.客户 ...
- Hibernate 系列教程12-继承-Join策略
Employee public class Employee { private Long id; private String name; HourlyEmployee public class H ...
- Servlet与jsp间的传值问题
Servlet与JSP 之间的传值有两种情况:JSP -> Servlet, Servlet -> JSP.通过对象 request和 session (不考虑 application)完 ...
- RING0,RING1,RING2,RING3
Intel的CPU将特权级别分为4个级别:RING0,RING1,RING2,RING3.Windows只使用其中的两个级别RING0和RING3,RING0只给操作系统用,RING3谁都能用.如果普 ...
- 在win7/8/10鼠标右键添加按下SHIFT键时弹出的“在此处打开命令窗口”
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Drive\shell\cmd]@="@shell32.dll,-8506&q ...
- CentOS 下mysql 的安装
1.安装mysql服务器 yum -y install mysql-server 2.装入service启动服务 /etc/rc.d/init.d/mysqld start 3.设置mysql服务开机 ...
- Linux -- ls只显示目录
ls没有直接显示目录的选项, 不过根据目录和文件显示的差异,可以搭配grep来实现 方法1: ll | grep "^d" 方法2: ls -F | grep$ "/$& ...