1.21 贪心入门上午PAT例题题解】的更多相关文章

1.B1023 #include<cstdio> int a[10]; int main() { for(int i=0;i<=9;i++) { scanf("%d",&a[i]); } for(int i=1;i<=9;i++) { if(a[i]) { printf("%d",i); a[i]--; break; } } for(int i=0;i<=9;i++) { while(a[i]--) { printf("…
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给出链接的所以不准偷偷复制博主的博客噢~~ 时隔两年,又开始刷题啦,这篇用于PAT甲级题解,会随着不断刷题持续更新中,至于更新速度呢,嘿嘿,无法估计,不知道什么时候刷完这100多道题. 带*的是我认为比较不错的题目,其它的难点也顶多是细节处理的问题~ 做着做着,发现有些题目真的是太水了,都不想写题解了…
题目大意 给出一些区间和一些点,一个点如果在一个区间内,那么此两者可以匹配.问匹配数最大是多少. 题解 这样的题我们一般都是站在区间上去找与其配对的点.我们可以得到如下性质: 对于一段区间\([l_1,r_1]\)的任意两点\(a,b, a<b\),它们对于任意一个区间\([l_2,r_2],l_2<l_1\),\(a\in[l_2,r_2]\)的可能性(以后用P表示)\(P(a\in[l_2,r_2])>P(b\in[l_2,r_2])\). 什么叫"可能性大"呢?…
早期部分代码用 Java 实现.由于 PAT 虽然支持各种语言,但只有 C/C++标程来限定时间,许多题目用 Java 读入数据就已经超时,后来转投 C/C++.浏览全部代码:请戳 本文谨代表个人思路,欢迎讨论;) 1031. Hello World for U (20) 题意 将给定的字符串打印出 U 型. 比如给定helloworld,打印出 1 2 3 4 5 h d e l l r lowo 设定左边的字符个数为 n1,底边字符个数为 n2,右边字符个数为 n3.需要满足 n1 = n3…
1001. A+B Format (20) 注意负数,没别的了. 用scanf来补 前导0 和 前导的空格 很方便. #include <iostream> #include <cstdio> using namespace std; ]; int main() { int A,B; cin>>A>>B; A+=B; ) { A=-A; cout<<"-"; } ; while(A) { a[n++]=A%; A/=; } ;…
今年暑假不AC Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 43056    Accepted Submission(s): 22946 Problem Description “今年暑假不AC?”“是的.”“那你干什么呢?”“看世界杯呀,笨蛋!”“@#$%^&*%...”确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会…
1035. Password (20) 时间限制 400 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is…
1025. PAT Ranking (25) 时间限制 200 ms 内存限制 32000 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneous…
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For examp…
1036. Boys vs Girls (25) This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students. Input Specification: Each input file contains one test case. Each case contain…