PTA 甲级
文章平均质量分 57
NEUMANN2077
这个作者很懒,什么都没留下…
展开
-
PTA甲级
#include<iostream>#include<algorithm>#include<cstring>#include<unordered_map>using namespace std;const int N = 40;int n;int postorder[N], inorder[N];unordered_map<int, int> l, r, pos;int q[N];// 返回的当前子树的根结点是多少int原创 2021-09-01 20:00:36 · 142 阅读 · 0 评论 -
PTA 甲级 General Palindromic Number (20 分)
题目链接General Palindromic Number题目描述 看题目链接个人想法:题目有所暗示,不要用字符串判定,用数字。代码:// 一个数字 水仙花数字#include<iostream>using namespace std;const int N = 1e4+10;int len = 0;int mark[N];int main(){ int x, radix; string s; cin >> x >原创 2021-08-15 11:04:02 · 45 阅读 · 0 评论 -
PTA 甲级 Reversible Primes (20 分)
题目链接Reversible Primes题目描述 A reversible prime in any number system is a prime whose “reverse” in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a prime. Now given any two po原创 2021-08-15 10:24:53 · 63 阅读 · 0 评论 -
PTA 甲级 Have Fun with Numbers (20 分)
题目链接Have Fun with Numbers题目描述Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the num原创 2021-08-15 09:39:09 · 96 阅读 · 0 评论 -
PTA 甲级 Radix (25 分)
题目链接Radix题目描述Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1N_1N1 and N2N_2N2 , your task原创 2021-08-14 16:29:48 · 159 阅读 · 0 评论 -
PTA甲级 Sign In and Sign Out (25 分)
题目链接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 are supposed to find t原创 2021-08-14 11:12:31 · 86 阅读 · 0 评论 -
PTA 甲级 1008 Elevator (20 分)
题目链接: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 >seconds to move the elev原创 2021-08-14 10:23:24 · 43 阅读 · 0 评论 -
PTA 甲级 1005 Spell It Right (20 分)
题目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. Each case occupies one line which contains an N (≤1010010原创 2021-08-14 09:56:50 · 47 阅读 · 0 评论