简单模拟
julia7_
keep coding
展开
-
A1031 Hello World for U(20 分)(图形输出)
Given any string ofN(≥5) characters, you are asked to form the characters into the shape ofU. For example,helloworldcan be printed as:h de ll rlowoThat is, the characters must be prin...原创 2019-01-12 20:16:01 · 202 阅读 · 0 评论 -
剑指Offer(六):旋转数组的最小数字(水题)(数组)
题目把一个数组最开始的若干个元素搬到数组的末尾,我们称之为数组的旋转。 输入一个非递减排序的数组的一个旋转,输出旋转数组的最小元素。 例如数组{3,4,5,1,2}为{1,2,3,4,5}的一个旋转,该数组的最小值为1。 NOTE:给出的所有元素都大于0,若数组大小为0,请返回0。AC代码:class Solution {public: int minNumberInRot...原创 2019-03-10 23:51:07 · 94 阅读 · 0 评论 -
A1017 Queueing at Bank (25 分)(银行排队)(简单模拟)(时间转化)
Suppose a bank hasKwindows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow li...原创 2019-03-11 15:25:39 · 328 阅读 · 0 评论 -
B1051 复数乘法 (15 分)(保留两位的输出格式要注意)
复数可以写成(A+Bi)的常规形式,其中A是实部,B是虚部,i是虚数单位,满足i2=−1;也可以写成极坐标下的指数形式(R×e(Pi)),其中R是复数模,P是辐角,i是虚数单位,其等价于三角形式(R(cos(P)+isin(P))。现给定两个复数的R和P,要求输出两数乘积的常规形式。输入格式:输入在一行中依次给出两个复数的R1,P...原创 2019-03-10 21:58:36 · 534 阅读 · 0 评论 -
B1050 螺旋矩阵 (25 分)(找规律图形输出)
本题要求将给定的N个正整数按非递增的顺序,填入“螺旋矩阵”。所谓“螺旋矩阵”,是指从左上角第 1 个格子开始,按顺时针螺旋方向填充。要求矩阵的规模为m行n列,满足条件:m×n等于N;m≥n;且m−n取所有可能值中的最小值。输入格式:输入在第 1 行中给出一个正整数N,第 2 行给出N个待填充的正整数。所有数字不超过104,相邻数字以空格分隔。输出格式:...原创 2019-03-10 21:18:06 · 387 阅读 · 0 评论 -
B1027 打印沙漏(图形输出)
本题要求你写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印***** *** * ********所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。给定任意N个符号,不一定能正好组成一个沙漏。要求打印出的沙漏能用掉尽可能多的符号。输入格式:...原创 2019-01-12 19:29:15 · 327 阅读 · 0 评论 -
A1036 Boys vs Girls(查找女生、男生中分数最高)
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 t...原创 2019-01-12 14:28:45 · 262 阅读 · 0 评论 -
A1009 Product of Polynomials(两个多项式相乘)
This time, you are supposed to findA×BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...原创 2019-01-11 14:00:51 · 142 阅读 · 0 评论 -
A1002 A+B for Polynomials (两个多项式相加)
This time, you are supposed to findA+BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...原创 2019-01-11 12:54:37 · 376 阅读 · 0 评论 -
B1010 一元多项式求导(25 分)
设计函数求一元多项式的导数。(注:xn(n为整数)的一阶导数为nxn−1。)输入格式:以指数递降方式输入多项式非零项系数和指数(绝对值均为不超过 1000 的整数)。数字间以空格分隔。输出格式:以与输入相同的格式输出导数多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。注意“零多项式”的指数和系数都是 0,但是表示为0 0。输入样例:3 4 ...原创 2019-01-11 12:10:39 · 210 阅读 · 0 评论 -
A1096 Consecutive Factors (20 分)(求N能被连续整数乘积整除的最多个数)
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, and 7 are the three consecutive numbers. Now given ...原创 2019-01-30 16:39:59 · 285 阅读 · 0 评论 -
A1027 Colors in Mars (十进制转为两位数的13进制)(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 digits are forRed, the middle 2 dig...原创 2019-01-12 23:27:55 · 127 阅读 · 0 评论 -
B1022 D进制的A+B (十进制转为D进制)(20 分)
输入两个非负 10 进制整数A和B(≤2^30−1),输出A+B的D(1<D≤10)进制数。输入格式:输入在一行中依次给出 3 个整数A、B和D。输出格式:输出A+B的D进制数。输入样例:123 456 8输出样例:1103思路:本题为常规的进制转换类题目,需要理解熟记进制转换的代码实现。进制转化采用除基取...原创 2019-01-30 11:33:36 · 204 阅读 · 0 评论 -
A1058 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 and twenty-nine Knuts to a Si...原创 2019-01-12 23:44:41 · 171 阅读 · 0 评论 -
B1019 数字黑洞 (20 分)
给定任一个各位数字不完全相同的 4 位正整数,如果我们先把 4 个数字按非递增排序,再按非递减排序,然后用第 1 个数字减第 2 个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的6174,这个神奇的数字也叫 Kaprekar 常数。例如,我们从6767开始,将得到7766 - 6677 = 10899810 - 0189 = 96219621 - 12...原创 2019-01-27 18:49:57 · 203 阅读 · 0 评论