PTA-基础题
人间玉京长生剑
没有什么简介
展开
-
PTA 数列求和加强版
PTA编程题:5-38 数列求和-加强版 (20分)给定某数字AA(1\le A\le 91≤A≤9)以及非负整数NN(0\le N\le 1000000≤N≤100000),求数列之和S = A + AA + AAA + \cdots + AA\cdots AS=A+AA+AAA+⋯+AA⋯A(NN个AA)。例如A=1A=1, N=3N=3时,S = 1原创 2016-04-04 17:11:07 · 2753 阅读 · 0 评论 -
剪花布条
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢?Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。Outpu原创 2017-03-06 20:59:29 · 271 阅读 · 0 评论 -
Switch Game
There are many lamps in a line. All of them are off at first. A series of operations are carried out on these lamps. On the i-th operation, the lamps whose numbers are the multiple of i change the con原创 2017-03-06 20:52:20 · 353 阅读 · 0 评论 -
Ignatius and the Princess IV
"OK, you are not too bad, em... But you can never pass the next test." feng5166 says."I will tell you an odd number N, and then N integers. There will be a special integer among them, you have t原创 2017-03-06 20:49:32 · 227 阅读 · 0 评论 -
A water problem
Two planets named Haha and Xixi in the universe and they were created with the universe beginning.There is 73 days in Xixi a year and 137 days in Haha a year. Now you know the days原创 2017-03-06 20:42:54 · 209 阅读 · 0 评论 -
Lucky Number
To Chinese people, 8 is a lucky number. Now your task is to judge if a number is lucky.We say a number is lucky if it’s a multiple of 8, or the sum of digits that make up the number is a multiple原创 2017-03-06 20:35:32 · 380 阅读 · 0 评论 -
求最长回文串
给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度. 回文就是正反读都是一样的字符串,如aba, abba等 Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S 两组case之间由空行隔开(该空行不用处理) 字符串长度len Output每一行一个整数x,对应一组case,表示该组case的原创 2017-03-08 21:20:31 · 378 阅读 · 0 评论 -
PAT乙级-A除以B
本题要求计算A/B,其中A是不超过1000位的正整数,B是1位正整数。你需要输出商数Q和余数R,使得A = B * Q + R成立。输入格式:输入在1行中依次给出A和B,中间以1空格分隔。输出格式:在1行中依次输出Q和R,中间以1空格分隔。输入样例:123456789050987654321 7输出样例:17636684150141093474原创 2017-03-03 10:53:51 · 348 阅读 · 0 评论 -
PAT乙级 部分A+B
正整数A的“DA(为1位整数)部分”定义为由A中所有DA组成的新整数PA。例如:给定A = 3862767,DA = 6,则A的“6部分”PA是66,因为A中有2个6。现给定A、DA、B、DB,请编写程序计算PA + PB。输入格式:输入在一行中依次给出A、DA、B、DB,中间以空格分隔,其中0 10。输出格式:在一行中输出PA + PB的值。输入样例1原创 2017-03-03 09:55:21 · 277 阅读 · 0 评论 -
1019-数字黑洞
给定任一个各位数字不完全相同的4位正整数,如果我们先把4个数字按非递增排序,再按非递减排序,然后用第1个数字减第2个数字,将得到一个新的数字。一直重复这样做,我们很快会停在有“数字黑洞”之称的6174,这个神奇的数字也叫Kaprekar常数。例如,我们从6767开始,将得到7766 - 6677 = 10899810 - 0189 = 96219621 - 1269 = 8352853原创 2017-03-15 21:11:38 · 211 阅读 · 0 评论