随笔分类 - PAT (Basic Level) Practise
摘要:求最大最小值,不需要排序代码如下: 1 #include 2 using namespace std; 3 4 int n,max_grade=-1,min_grade=150; 5 int grade_temp; 6 string name1,name2,num1,num2,name_temp,...
阅读全文
摘要:题目链接:http://www.patest.cn/contests/pat-b-practise/1003得到“答案正确”的条件是:1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符;2. 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字...
阅读全文
摘要:把一个数串各个数位上的数加起来,然后用给定格式输出,这个输出很有讲究,一个大数从高位向地位输出。代码如下:#includeusing namespace std;char str[110];int res=0,flag=0;char output[15][5] = {"ling","yi","er"...
阅读全文
摘要:这是一道模拟题,大致题意就:是偶数除以2,奇数(3n+1)除以2,到1结束代码如下:#includeusing namespace std;int cnt=0;void cal(int n){ if(n==1) { cout>n) { cnt=0; cal(n); } return 0;}
阅读全文