
PAT
混有两篇乙级,其他全甲级
(づど)
慢慢地
展开
-
【软件安装】Notepad++上配置C\C++(适合不常用C语言的人)
window10上搭建简单的C\C++运行环境,适合不常用C语言编写代码的人原创 2020-04-19 14:31:25 · 585 阅读 · 0 评论 -
1003 我要通过! (20 分) C++
只拿了19分,递归思想,规则三有点头晕真的#include<bits/stdc++.h>using namespace std;char n[10][102];int abc(int a,int b,int c){ if(b>1) return abc(a,b-1,c-a); else if(b==1 && a==0 &&...原创 2019-03-16 14:17:00 · 332 阅读 · 0 评论 -
1010 一元多项式求导 (25 分)
这题不难,主要是我写循环输入的的时候,自己的电脑没办法跳出循环while(scanf("%d%d",&i,&j)!=EOF),但是PTA能///满分#include<stdio.h>int main(){ int a[1000]={0},i,j,n=0; while(scanf("%d%d",&i,&j)!=EOF){ ...原创 2019-03-19 22:25:16 · 170 阅读 · 0 评论 -
1086 Tree Traversals Again (25 分)C语言——根据前序、中序遍历输出后序
代码#include<stdio.h>#include<string.h>struct{ int left,right;}node[35];int st[35],top=0;void postorder(int num){ int i; if(node[num].left!=-1) postorder(node[num].left);...原创 2019-02-28 19:18:51 · 341 阅读 · 0 评论 -
1056 Mice and Rice (25 分)C语言——ceil()
1056 Mice and Rice (25 分)Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each m...原创 2019-02-25 00:20:42 · 167 阅读 · 0 评论 -
1058 A+B in Hogwarts (20 分)C语言
1058 A+B in Hogwarts (20 分)If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon ...原创 2019-02-25 00:30:20 · 177 阅读 · 0 评论 -
1064 Complete Binary Search Tree (30 分)C语言——树的inorder();
1064 Complete Binary Search Tree (30 分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with key...原创 2019-02-26 10:17:28 · 608 阅读 · 0 评论 -
1090 Highest Price in Supply Chain (25 分)C++——vector 万能头文件bits/stdc++.h
分析用C写这个 第一个想法是建一个child[1e5+2][1e5+2],感觉有点大 系统会崩,而且还得额外再建一个num[1e5+2]存储每个节点孩子数量,于是改用C++超棒的vectorvector常用函数简单定义 vector<int>obj[1005]; push_back(int x);尾部增加一个数 pop_back();尾部删除一个数 size();返回...原创 2019-03-02 10:50:16 · 304 阅读 · 0 评论 -
1066 Root of AVL Tree (25 分)C语言——平衡二叉树的旋转
1066 Root of AVL Tree (25 分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by...原创 2019-02-26 15:05:15 · 229 阅读 · 0 评论 -
1079 Total Sales of Supply Chain (25 分)C语言——DFS
1079 Total Sales of Supply Chain (25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starti...原创 2019-02-27 14:14:27 · 259 阅读 · 0 评论 -
1006 Sign In and Sign Out (25 分)C语言——字符串处理
1006 Sign In and Sign Out (25 分)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 r...原创 2019-02-13 20:02:15 · 583 阅读 · 0 评论 -
1020 Tree Traversals (25 分)C语言——中序后序求层次遍历
1020 Tree Traversals (25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level ord...原创 2019-02-13 19:57:26 · 313 阅读 · 0 评论 -
1030 Travel Plan (30 分)C语言——Dijkstra算法
1030 Travel Plan (30 分)A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler t...原创 2019-02-13 19:50:05 · 257 阅读 · 0 评论 -
1037 Magic Coupon (22/25 分)C语言——qsort()
1037 Magic Coupon (25 分)The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times t...原创 2019-02-14 19:24:17 · 262 阅读 · 1 评论 -
1041 Be Unique (20 分)C语言
1041 Be Unique (20 分)Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,104]...原创 2019-02-14 21:58:57 · 199 阅读 · 0 评论 -
1027 Colors in Mars (20 分)C语言
1027 Colors in Mars (20 分)People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digit...原创 2019-02-23 01:51:50 · 148 阅读 · 0 评论 -
1050 String Subtraction (20 分)C语言
1050 String Subtraction (20 分)Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calcu...原创 2019-02-23 02:25:21 · 262 阅读 · 0 评论 -
1051 Pop Sequence (25 分)C语言
1051 Pop Sequence (25 分)Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a ...原创 2019-02-23 04:27:28 · 325 阅读 · 0 评论 -
1083 List Grades (25 分)C语言 20分
1083 List Grades (25 分)Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student rec...原创 2019-02-27 22:23:13 · 167 阅读 · 0 评论 -
1084 Broken Keyboard (17/20 分)C语言——strchr()
1084 Broken Keyboard (20 分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a st...原创 2019-02-28 00:08:02 · 191 阅读 · 0 评论 -
1053 Path of Equal Weight (30 分)C语言——DFS+qsort()
1053 Path of Equal Weight (30 分)Given a non-empty tree with root RRR, and with weight WiW_iWi assigned to each tree node TiT_iTi. The weight of a path from RRR to LLL is defined to be the sum ...原创 2019-02-23 18:09:02 · 751 阅读 · 0 评论 -
1054 The Dominant Color (20 分)C语言
1054 The Dominant Color (20 分)Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest p...原创 2019-02-24 18:36:20 · 397 阅读 · 2 评论 -
1036 Boys vs Girls (25 分)C语言
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:Eac...原创 2019-02-14 17:06:10 · 385 阅读 · 0 评论