practise专题

1016. Phone Bills (25) @ PAT (Advanced Level) Practise

自己写的只得了19分,还有6分的case没有通过,代码写的略渣。 附个人家的链接:http://blog.csdn.net/sunbaigui/article/details/8657062 #include<iostream>#include<stdio.h>#include<list>#include<vector>#include<string>#include<algor

1014. Waiting in Line @ PAT (Advanced Level) Practise

NOTICE: 1.题目中讲的“Note that since the bank is closed everyday after 17:00, for those customers who cannot be served before 17:00, you must output "Sorry" instead.” 其实是说开始服务时间不能超过17:00而不是服务结束时间。 2.更简洁

PAT (Basic Level) Practise

题目集:pat.zju.edu.cn/contests/pat-b-practise 注:个人练习,仅供交流,欢迎指正,禁止商业用途。 B1001 #include <iostream>using namespace std;int mainB1001(){int a;int count=0;cin>>a;while(1){//cout<<count<<endl;if

浙大PAT (Advanced Level) Practise 1009 Product of Polynomials (25)

/*本题与1002类似,只是将简单的两个数组相加,改为两个数组相乘,采用双循环可解,代码如下*/#include <iostream>using namespace std;int main(){int K;while(cin>>K){double a[1001]={0},b[1001]={0},c[2001]={0}; //a[],b[]数组储存两个系数数组,c[]储存结果int n

浙大PAT (Advanced Level) Practise 1002. A+B for Polynomials (25)

/*这题相当于求多项式前面的系数和,用数组存储数组,对应项相加,即可得到结果*/#include <iostream>#include <cstring>using namespace std;int main(){int k;while(cin>>k){int n,c=0;double an;double suzu[1005];memset(suzu,0,sizeof(suzu));w

浙大PAT (Advanced Level) Practise 1001 A+B Format (20)

/*本题是普通A+B,只是结果输出是特殊的格式*/#include <iostream>using namespace std;int main(){int a,b,c;while(cin>>a>>b){c=a+b;if(c<0){c=-c;printf("-");}if(c>=1000000) //这里对不同范围内的和的输出分类,以类似的方法解决输出问题p

浙大PAT (Advanced Level) Practise 1008 Elevator (20)

/*本题是道水题,直接考察前后两个数字的关系解题,代码如下:*/#include <iostream>using namespace std;int main(){int n;while(cin>>n){int num[10000]={0};int t=0;for(int i=1;i<=n;++i){cin>>num[i];if(num[i]>num[i-1]) //上

浙大PAT (Advanced Level) Practise 1007

/*此题求最大连续子序列,可以用动态规划的方法,用变量先记录遍历到数组的最大和及i和j,一直遍历,并与当前最大子序列和比较。如果大于当前最大子序列和,则置换之,否则,重新开始,直至遍历完数组。*/#include <iostream>using namespace std;int main(){int K;while(cin>>K){int jilu=-1,sum=0,first=0,la

浙大PAT (Advanced Level) Practise 1006

//本题是一道比较简单的排序题,建立一个结构体并用容器vector存储每条记录,以algorithm排序,获取开门人和关门人id。//代码如下:#include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;struct Person

PAT (Advanced Level) Practise 1005

本题比较简单,利用数组储存大整数,每位数字求和后,再利用sprintf函数将数字返回为字符串,然后输出。代码如下: #include <iostream>#include <string>using namespace std;int main(){string s;string numE[10]={"zero","one","two","three","four","five