2018年3月的全部文章
@kidultff

PAT-A 真题- 1007. Maximum Subsequence Sum

原题干:Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the continuous subsequenc ...
  • 0
  • 0
@kidultff

动态规划--最大连续子序列和

0x00、引言假设有这么一道题:给定一串序列A={-2, 11, -4, 13, -5, -2},要求求出 i 和 j ,使得Ai+......+Aj的和最大。这道题最直截了当的方法是暴力求解,从左端点到右端点依次遍历。但是这样时间复杂度会十分的高,这种问 ...
  • 0
  • 0
@kidultff

PAT-A 真题- 1006. 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 ...
  • 0
  • 0
@kidultff

PAT-A 真题- 1005. Spell It Right

原题干: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 ...
  • 0
  • 0
@kidultff

PAT-A 真题- 1052. Linked List Sorting

原题干:A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked ...
  • 0
  • 0