![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 60
Cute_Abacus
这个作者很懒,什么都没留下…
展开
-
2021 阿里笔试题 完美对
完美对题目链接其实规律在于ai-aj=-(bi-bj)那么只需要一个map来存储这个序列的差并作为自己的code,用两个map统计优化,就能实现快速的查询import java.util.*;public class Main { //设计获取反向code public static String getAnti(String code){ StringBuilder s = new StringBuilder(); for(int i = 0;i原创 2022-03-12 17:46:45 · 700 阅读 · 2 评论 -
棋盘问题 POJ - 1321
题目在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 , k ...原创 2018-08-17 10:50:00 · 104 阅读 · 0 评论 -
Dungeon Master POJ - 2251
You 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...原创 2018-08-17 10:51:00 · 273 阅读 · 0 评论 -
Catch That Cow POJ - 3278
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN(0 ≤N≤ 100,000) on a number line and the cow is at a pointK(0 ≤K≤ 100,0...原创 2018-08-17 10:53:00 · 88 阅读 · 0 评论 -
Fliptile POJ - 3279
Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate anM×Ngrid (1 ≤M≤ 15; 1 ≤N≤ 15)...原创 2018-08-17 10:54:00 · 103 阅读 · 0 评论 -
Find The Multiple POJ - 1426
Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there...原创 2018-08-17 10:55:00 · 193 阅读 · 0 评论 -
Prime Path POJ - 3126
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices.— It is a matter of se...原创 2018-08-17 10:56:00 · 92 阅读 · 0 评论 -
Pots POJ - 3414
You are given two pots, having the volume ofAandBliters respectively. The following operations can be performed:FILL(i) fill the poti(1 ≤i≤ 2) from the tap; DROP(i) empty the po...原创 2018-08-17 10:57:00 · 119 阅读 · 0 评论 -
Fire Game FZU - 2150
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start...原创 2018-08-17 11:00:00 · 133 阅读 · 0 评论 -
Fire!
Fire!UVA - 11624#include<iostream>#include<stdio.h>#include<algorithm>#include<queue>using namespace std;struct Node { int kind; int x, y; int step = 0;...原创 2018-08-17 11:01:00 · 128 阅读 · 0 评论 -
迷宫问题 POJ - 3984
定义一个二维数组:int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。Input一个5 ×...原创 2018-08-17 11:03:00 · 93 阅读 · 0 评论 -
非常可乐 HDU - 1495
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为。因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多。但seeyou的手中只有两个杯子,它们的容量分别是N 毫升和M 毫升 可乐的体积为S (S<101)毫升 (正好装满一瓶) ,它们三个之间可以相互倒可乐 (都是没有刻度的,且 S==N+M,101>S>...原创 2018-08-17 11:05:00 · 88 阅读 · 0 评论 -
Find a way HDU - 2612
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the co...原创 2018-08-17 11:06:00 · 397 阅读 · 0 评论 -
Monkey and Banana HDU - 1069
题目A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the ...原创 2018-08-16 16:10:00 · 131 阅读 · 0 评论 -
Ignatius and the Princess IV HDU - 1029
题目"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...原创 2018-08-16 16:09:00 · 95 阅读 · 0 评论 -
HDU 1263 水果 二维map or 排序
水果Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 8572 Accepted Submission(s): 3411Problem Description 夏天来了好开心啊,呵呵,好多好多水果 Joe经营着一个不大的原创 2018-01-26 17:27:57 · 264 阅读 · 0 评论 -
蓝桥杯 16-8进制转换问题
蓝桥杯原创 2018-01-18 18:23:33 · 616 阅读 · 0 评论 -
折半枚举(双向搜索)
4 values whose sum is 0给定各有n个整数的四个数列A,B,C,D。要从每个数列中各取出1个数,使四个数的和为0。求出这样的组合的个数。当一个数列中有多个相同的数字时,把它们作为不同的数字看待。 输入:n=6 A={-45, -41, -36, -36, 26, -32}; B={22 ,-27 ,53 ,30 ,-38 ,-54}; C={42 ,56 ,-37, 75原创 2017-11-07 21:55:55 · 318 阅读 · 0 评论 -
Jessica's Reading Problem
Jessica's Reading Problem原创 2017-10-08 20:45:53 · 398 阅读 · 0 评论 -
D - Fliptile
Fliptile原创 2017-10-08 18:04:01 · 646 阅读 · 4 评论 -
Face The Right Way
Face The Right Way原创 2017-10-08 16:46:07 · 335 阅读 · 2 评论 -
Subsequence
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subs原创 2017-10-04 15:41:22 · 358 阅读 · 0 评论 -
排兵布阵 线段树
排兵布阵 线段树原创 2017-09-27 20:24:35 · 708 阅读 · 0 评论 -
斐波那契搜索法
直接看例子吧,之前看别人的讲解都没咋看懂其实就是先用区间长度除以容差,得到要分多少份,这个题目的话就是10000份,那么斐波那契数列中大于10000的最小的数是谁呢?就是F21F_{21}F21=10946,所以接下来将会把F20/F21F_{20}/F_{21}F20/F21作为迭代参数R0R_0R0,以此类推,求出比区别常数小的区间后,取中点求值即可。...原创 2019-07-04 20:50:54 · 1432 阅读 · 0 评论 -
基本算法_位运算_lowbit
lowbit运算lowbit(n)定义为非负整数n在二进制表示下“最低位的1及后面的所有0”构成的数值。比如二进制10011111010的lowbit就是最后两位10。那么我们如何得到lowbit的值呢?首先:取反。~ 10011111010= 01100000101然后:+1 01100000101+1= 01100000110我们会发现,此时只有lo...原创 2018-08-12 20:36:00 · 226 阅读 · 0 评论 -
Max Sum Plus Plus HDU - 1024
题目:Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem....原创 2018-08-16 16:06:00 · 95 阅读 · 0 评论