pat记录
文章平均质量分 55
sduuntion
这个作者很懒,什么都没留下…
展开
-
pat 1004 Counting Leaves
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with原创 2014-10-24 09:57:01 · 451 阅读 · 0 评论 -
pat 1019. General Palindromic Number
水题#include using namespace std;int main(){ //freopen("F:/CppProject/data/1019.txt","r",stdin); long long n,b; cin>>n>>b; int num[50]; if(n==0 || n==1) { cout<<"Yes"<<endl<<n<<endl; re原创 2014-11-21 10:20:43 · 463 阅读 · 0 评论 -
pat 1023. Have Fun with Numbers
1,输入的数最长有20位,即使用long long 类型 的数也不够,所以用字符串处理2,zhu原创 2014-11-20 22:58:52 · 470 阅读 · 0 评论 -
pat 1011. World Cup Betting
题目地址:http://pat.zju.edu.cn/contests/pat-a-practise/1011原创 2014-10-24 16:50:33 · 483 阅读 · 0 评论 -
pat 1013 Battle Over Cities
1013:直接使用bfs计算连通分支数,注意在开始bfs时将被占领的城市表示已访问过的点,visited[p]=1#include #include #include using namespace std;int map[1005][1005],temp[1005][1005],visited[1005];int n,m,k;void dfs(int s){原创 2014-10-31 17:47:28 · 566 阅读 · 0 评论 -
pat 1024 Palindromic Number
这一题几个注意的地方:1,n的最大长度为10的10次方,k最大原创 2014-11-23 15:54:33 · 518 阅读 · 0 评论 -
pat 1027 Colors in Mars
没什么好说的,注意输入为0的时候的输出吧原创 2014-11-23 19:26:29 · 481 阅读 · 0 评论 -
pat 1028 List Sorting
很简单的一个题,但是一直卡在最后一个原创 2014-11-23 20:25:01 · 1084 阅读 · 0 评论 -
pat,1031Hello World for U
注意n2>n1和n3.#include #include #include using namespace std;char str[90];int main(){ scanf("%s",str); int len =strlen(str); int n2=(len+2)/3>=3?(len+2)/3:3; int n3=(len-n2)/2,n1=n3; i原创 2014-11-23 21:42:41 · 692 阅读 · 0 评论 -
pat 1022. Digital Library
水题,熟悉一下cin的getline方法和原创 2014-11-20 19:32:42 · 484 阅读 · 0 评论 -
pat 1021. Deepest Root
这题比较简单,我的思路是1,从任意点开始一次bfs找到最远的jie原创 2014-11-20 00:17:54 · 559 阅读 · 0 评论 -
pat 1012 The Best Rank
注意有并列的时候的名次,比如两个第一名则为1,1,3而不是1,1,2原创 2014-10-31 17:44:09 · 512 阅读 · 0 评论 -
pat 1008. Elevator
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec原创 2014-10-24 10:05:28 · 514 阅读 · 0 评论 -
pat 1009. Product of Polynomials
This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the inf原创 2014-10-24 10:07:13 · 537 阅读 · 0 评论 -
pat 1005. Spell It Right
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case.原创 2014-10-24 10:11:07 · 571 阅读 · 0 评论 -
pat 1006 Sign In and Sign Out
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you原创 2014-10-24 10:01:55 · 675 阅读 · 0 评论 -
pat 1002 A+B for Polynomials
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a p原创 2014-10-24 09:54:46 · 508 阅读 · 0 评论 -
pat 1007. Maximum Subsequence Sum
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 Maximum Subsequence is the continuous subsequence which has the largest su原创 2014-10-24 10:04:11 · 509 阅读 · 0 评论 -
pat 1001 A+B Format
#include #include #include using namespace std;int main(){ int a,b; scanf("%d%d",&a,&b); int sum=a+b; char result[15]; int p=0; if(sum0) { //strcat(result,"-"); result[p]原创 2014-10-24 09:51:36 · 432 阅读 · 0 评论 -
pat 1015 Reversible Primes
将这个数(1)转为D进制数(2)将这个D进制数反转(3)将反转后的数再转为十进制数,这个十进制数依然是素数。 这样我们就输出“Yes”。原创 2014-11-17 19:51:53 · 667 阅读 · 0 评论 -
pat,1029Median
1,当队列长度n为偶数是,median是第n/2个数,当n为基数是,是第n/2+1个数2,原创 2014-11-23 21:13:37 · 583 阅读 · 0 评论