- 博客(19)
- 收藏
- 关注
转载 用分治思想求斐波那契数列(转自追梦__的博客)
原文链接其实我们还可以将这个算法求斐波拉契数列的第10000000项对m取余,这样用到矩阵的乘法,下面给出具体的矩阵推导以及代码。C++代码 #include<iostream> using namespace std; class Matrix{ public: int width,height; ...
2018-04-09 21:27:01 929
原创 PAT A1067. Sort with Swap(0,*) (25)
题目链接 Given any permutation of the numbers {0, 1, 2,..., N-1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort ...
2018-03-25 17:45:22 211
原创 PAT A1037. 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 the value of that pr...
2018-03-25 15:53:57 186
原创 PAT A1033. To Fill or Not to Fill (25)
题目链接 With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Diff...
2018-03-22 18:22:00 115
原创 PAT A1080. Graduate Admission (30)
题目链接代码:#include#include #include using namespace std;//N<=40000,M<=100,k<=5int now;struct Stu { int ge, gi, g; int sch[6]; int rank, id;};struct Sch { int quota
2018-02-04 19:03:10 175
原创 PAT A1075. PAT Judge (25)
题目链接注意边界条件,代码如下:#include#include #include using namespace std;int fmark[6];//注意边界条件,例如6号提交了,但得分为0,仍需要输出//所以在结构体中,设置flag来表示是否有“通过编译的提交”//如果有,则flag记为truestruct User { int id, sc
2018-02-03 22:21:24 332
原创 PAT A1055. The World's Richest (25)
题目链接Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on
2018-02-03 19:29:42 210
原创 PAT A1028. List Sorting (25)
题目链接Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two inte
2018-02-03 17:28:03 169
原创 A1012. The Best Rank (25)
A1012To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra),
2018-01-30 18:16:51 233 1
原创 A1025. PAT Ranking (25)
A1025Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ra
2018-01-29 21:36:32 184
原创 A1046. Shortest Distance (20)
A1046The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input
2018-01-29 00:11:09 166
原创 A1042. Shuffling Machine (20)
A1042The machine shuffles a deck of 54 cards according to a given random order and repeats for a given number of times. It is assumed that the initial status of a card deck is in the following ord
2018-01-29 00:05:20 165
原创 A1031. Hello World for U (20)
A1031Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:h de ll rlowoThat is, the characters
2018-01-29 00:02:58 352
原创 A1019. General Palindromic Number (20)
A1019A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindro
2018-01-29 00:01:17 163
原创 A1009. Product of Polynomials (25)
A1009This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains
2018-01-29 00:00:01 178
原创 A1006. Sign In and Sign Out (25)
A1006At 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
2018-01-28 23:58:40 168
原创 A1002. A+B for Polynomials (25)
A1002This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information
2018-01-28 23:57:18 287
原创 A1001. A+B Format (20)
A1001Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input fi
2018-01-28 23:55:36 173
原创 A1082. Read Number in Chinese (25)
A1082题目描述如下:Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output "Fu" first if it is negative. For example, -123456789 is read as "Fu yi Yi e...
2018-01-28 21:39:36 311
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人