2 Defepe




TA的排名 24w+

POJ 2387 Til the Cows Come Home (dijkstra求最短路径)

Til the Cows Come HomeBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get back as quickly as possibleFarme

2020-07-16 22:46:07

HDU 1008 Elevator(模拟)

ElevatorThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4

2020-07-12 22:31:28

HDU 1005 Number Sequence(周期性循环 AC题目)

Number SequenceA number sequence is defined as followsf(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7Given A, B, and n, you are to calculate the value of f(n).InputThe input consists of multiple test cases. Each test case contains 3

2020-07-12 20:18:12

HDU 1001 Sum Problem (累加和)

Sum ProblemHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge)In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + … + n.InputThe input will consist of a series of integers n, one integer per line.OutputFor each case, output

2020-07-12 18:58:11

HDU 1753 大明A+B(进阶版大整数加法)

大明A+B话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。Input本题目包含多组测试数据,请处理到文件结束。每一组测试数据在一行里面包含两个长度不大于400的正小数A和B。Output请在一行里面输出输出A+B的值,请输出最简形式。详细要求请见Sample Output。Sample Inpu

2020-07-12 11:01:06

计蒜客 T1389 检验身份证(题解)

检验身份证一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下首先对前17位数字加权求和,权重分配为:{777,999,101010,555,888,444,222,111,666,333,777,999,101010,555,888,444,242424};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值Z:0 1 2 3 4 5 6 7 8 9 10M:1 0 X 9 8 7 6 5 4 3 2现在给定一些身份证号码,请你验证校验

2020-07-11 22:22:32

HDU 1282 回文数猜想(题解)


2020-07-11 21:07:08

POJ 3438 Look and Say (字符串)

Look and SayThe look and say sequence is defined as follows. Start with any string of digits as the first element in the sequence. Each subsequent element is defined from the previous one by “verbally” describing the previous element. For example, the st

2020-07-11 16:53:09

UVA 119 Greedy Gift Givers (简单题)

Greedy Gift GiversThis problem involves determining, for a group of gift-giving friends, how much more each person givesthan they receive (and vice versa for those that view gift-giving with cynicism).In this problem each person sets aside some money f

2020-07-11 15:57:28

HDU 1004 Let the Balloon Rise (map的使用,STL)

Let the Balloon RiseContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges’ favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and

2020-07-11 09:55:20

HDU 2714 ISBN (有点小坑)

ISBNFarmer John’s cows enjoy reading books, and FJ has discovered that his cows produce more milk when they read books of a somewhat intellectual nature. He decides to update the barn library to replace all of the cheap romance novels with textbooks on a

2020-07-10 22:27:23

FZU 1056 扫雷游戏(模拟题)

扫雷游戏扫雷是Windows自带的游戏。游戏的目标是尽快找到雷区中的所有地雷,而不许踩到地雷。如果方块上的是地雷,将输掉游戏。如果方块上出现数字,则表示在其周围的八个方块中共有多少颗地雷你的任务是在已知地雷出现位置的情况下,得到各个方块中的数据…… “ * ”表示有地雷.… “.”表示无…经过处理应得到10022101101110Input输入有多组数据,每组数据的第一行有两个数字,m,n(0<m,n<100)表示游戏中雷区的范围为m×n。接下

2020-07-10 19:28:42

POJ 2251 Dungeon Master(BFS 广度优先搜索)

Dungeon MasterYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south, east, west, up or down. You cannot mov

2020-07-10 16:18:41

POJ 1321棋盘问题 (dfs)

棋盘问题在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k <= n当为-1 -1时表示输入结束。随后的n行描述了棋盘的形状:每行有n个字符,其中 # 表示棋盘区域,

2020-07-10 08:39:27

PAT (Advanced Level) Practice 1009 Product of Polynomials(暴力循环)

题目链接Product of Polynomials这个其实就是一个多项式的相乘,做两层for循环就可以了。AC代码#include <stdio.h>int main(){ int k1, k2, b1[11], b2[11], cnt = 0; double c[2002] = {0}, a1[11], a2[11]; scanf("%d", &k1); for(int i = 0; i < k1; i++) scanf("%d %lf", &b1[i

2020-07-09 20:46:26

PAT (Advanced Level) Practice 1008 Elevator(模拟题)

ElevatorThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4

2020-07-09 16:53:14

PAT (Advanced Level) Practice 1007 Maximum Subsequence Sum(极短代码,O(n) 解决)

1007 Maximum Subsequence Sum题意: 求一串数字的最大连续和,并且输出最左端的数字和最右端的数字。这个题可以用一个for循环解决,时间复杂度O(n)。主要是先设置两个端点i,j,i为左端点,j为右端点。如图所示:-101234-5-2337-21i 和 j 开始都从数组下标0开始,然后用sum += a[ j ];如果发现sum < 0,i = j + 1, 继续循环(每次循环 j++),(因为sum > 0,不管怎样,往后加,都

2020-07-09 16:21:06

PAT (Advanced Level) Practice 1006 Sign In and Sign Out(性能高,方法简单,直接模拟)

Sign In and Sign OutAt 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 the ones who

2020-07-09 13:24:29

PAT (Advanced Level) Practice 1005 Spell It Right(简单的字符串处理)

Spell It RightGiven 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.Specification InputEach input file contains one test case. Each case occupies one line which contains a

2020-07-09 12:50:04

PAT (Advanced Level) Practice 1004 Counting Leaves(dfs 建立树)

Counting LeavesA family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input SpecificationEach input file contains one test case. Each case starts with a line containing 0<N<100, t

2020-07-09 12:01:26


勋章 我的勋章
  • 签到新秀
  • 阅读者勋章Lv2
    授予在CSDN APP累计阅读博文达到7天的你,是你的坚持与努力,使你超越了昨天的自己。
  • 持之以恒
  • 勤写标兵Lv4