PTA 自测-4 Have Fun with Numbers】的更多相关文章

#include<iostream> #include<string> #include<cstring> #include<vector> using namespace std; int main() { ] = {}, b[] = { }; string str; vector<int>doublenum;//记录翻倍后的数值 cin >> str; int length = str.length(); ; ; i < l…
00-自测4. Have Fun with Numbers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 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 24691…
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 numbers from 1 to 9, only in a…
自测-3 数组元素循环右移问题  一个数组A中存有N(N>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(M≥0)个位置,即将A中的数据由(A0A1···A​N-1​​)变换为(AN-M···AN-1A0A1⋯A​N-M-1)(最后M个数循环移至最前面的M个位置).如果需要考虑程序移动数据的次数尽量少,要如何设计移动的方法? 输入格式: 每个输入包含一个测试用例,第1行输入N(1≤N≤100)和M(M≥0):第2行输入N个整数,之间用空格分隔. 输出格式: 在一行中输出循环右移…
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 numbers from 1 to 9, only in a…
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 numbers from 1 to 9, only in a…
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 numbers…
连着这两道都是开学前数构老师的“爱心作业”,还没上课开学就给我们布置作业了,这道题有点小坑,也经常遇到类似的问题,特地拿出来记录一下. ------------------------------------------------题目---------------------------------------------------------- Notice that the number 123456789 is a 9-digit number consisting exactly t…
-自测1. 打印沙漏() 本题要求你写个程序把给定的符号打印成沙漏的形状.例如给定17个“*”,要求按下列格式打印 ***** *** * *** ***** 所谓“沙漏形状”,是指每行输出奇数个符号:各行符号中心对齐:相邻两行符号数差2:符号数先从大到小顺序递减到1,再从小到大顺序递增:首尾符号数相等. 给定任意N个符号,不一定能正好组成一个沙漏.要求打印出的沙漏能用掉尽可能多的符号. 输入格式: 输入在一行给出1个正整数N(<=)和一个符号,中间以空格分隔. 输出格式: 首先打印出由给定符号…
1. 本周学习总结 1.1 尝试使用思维导图总结有关继承的知识点. 1.2 使用常规方法总结其他上课内容. 1. 学习了继承的基本含义,用"class 子类名 extend 父类名"的格式来使子类抽取与父类的共同特征, 复用父类的代码: 2. 学习了在父类某个函数不满足子类的运用时覆盖的方法来创建一个适用于子类的同名函数: 3. 学习了多态即相同的形态(方法名)不同的定义来实现: 4. 学习了利用final定义一个类可以阻止其被继承: 5. 知道了Object是所有类的父类. 2. 书…
题目链接 题意:题目定义了Carmichael Numbers 即 a^p % p = a.并且p不是素数.之后输入p,a问p是否为Carmichael Numbers? 坑点:先是各种RE,因为poj不能用srand()...之后各种WA..因为里面(a,p) ?= 1不一定互素,即这时Fermat定理的性质并不能直接用欧拉定理来判定..即 a^(p-1)%p = 1判断是错误的..作的 #include<iostream> #include<cstdio> #include&l…
原题连接https://pta.patest.cn/pta/test/17/exam/4/question/264 Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "inside jobs" where employees collaborate…
1. 循环链表(约瑟夫问题) https://github.com/BodhiXing/Data_Structure 2. Have Fun with Numbers https://pta.patest.cn/pta/test/17/exam/4/question/263 #include <iostream> #include <cstring> using namespace std; int main() { ],b[],buffer[]; ]; int i,j,len;…
jmeter压力测试 前提场景的设置:单场景(单个接口进行压力测试一个请求)或混合场景(有业务流程的场景进行压力测试多个请求),压测时间一般在5--1515分组具体看需求. 数据准备:数据量少和数据量大的情况下,测试的结果是不一样的,在设计场景的时候是要考虑到这种情况的,要测试数据库中数据量大和数据量小的情况,如果是要测试数据量大的情况下,就要造数据了,造数据可以使用jmeter,操作数据库来造数据,也可以使用python连接数据库,批量的造数据. 查看压测结果:tps每秒钟处理的请求数,每个请…
题目 判断上三角矩阵 上三角矩阵指主对角线以下的元素都为0的矩阵:主对角线为从矩阵的左上角至右下角的连线. 本题要求编写程序,判断一个给定的方阵是否上三角矩阵. 输入格式: 输入第一行给出一个正整数T,为待测矩阵的个数.接下来给出T个矩阵的信息:每个矩阵信息的第一行给出一个不超过10的正整数n.随后n行,每行给出n个整数,其间以空格分隔. 输出格式: 每个矩阵的判断结果占一行.如果输入的矩阵是上三角矩阵,输出"YES",否则输出"NO". 输入样例: 2 3 1 2…
主要压测范围包括CPU测试.磁盘IO测试.线程测试.OLTP测试等,那么sysbench就可以满足我们的压测需求.下面我们简单来看下sysbench的安装使用以及压测结果的解读. 一.sysbench安装 sysbench安装其实非常简单,可以参考下git,这里我们讲下源码编译安装. 上传sysbench到服务器.解压.安装: [root@localhost~] yum -y install make automake libtool pkgconfig libaio-devel[root@lo…
PTA计算平均值( 一波三折) 现在为若干组整数分别计算平均值. 已知这些整数的绝对值都小于100,每组整数的数量不少于1个,不大于20个. 输入格式:首先输入K(不小于2,不大于20).接下来每一行输入一组数据(至少有一组数据),每组至少有一个数据,在有多个数据时,两个数据之间有1到3个空格.最后一行输入100,标志输入的结束. 输出格式:对于每一组数据,输出其前K个数据的均值,如果该组数据个数少于K时,则输出该组所有数据的均值.输出的均值只输出整数部分,直接忽略小数部分. 样例输入: 3 1…
00-自测5. Shuffling Machine (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid "insid…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/680 5-18 Hashing - Hard Version   (30分) Given a hash table of size NN, we can define a hash function . Suppose that the linear probing is used to solve collisions, we can easily obtain the status…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/679 5-17 Hashing   (25分) The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/678 5-16 Sort with Swap(0, i)   (25分) Given any permutation of the numbers {0, 1, 2,..., N-1N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/677 5-15 PAT Judge   (25分) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT. Input Spe…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/676 5-14 Insertion or Heap Sort   (25分) According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion s…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/675 5-13 Insert or Merge   (25分) According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort rem…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/674 5-12 How Long Does It Take   (25分) Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the project. Input Specification: Each inpu…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/669 5-7 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 w…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/668 5-6 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 d…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/667 5-5 Tree Traversals Again   (25分) An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys n…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/666 5-4 List Leaves   (25分) Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. Input Specification: Each input file contains one test case. For eac…
题目地址 https://pta.patest.cn/pta/test/16/exam/4/question/665 5-3 Pop Sequence   (25分) Given a stack which can keep MM numbers at most. Push NN numbers in the order of 1, 2, 3, ..., NN and pop randomly. You are supposed to tell if a given sequence of nu…