算法学习
Smi_l_e_
这个作者很懒,什么都没留下…
展开
-
Lala Land and Apple Trees
Amr lives in Lala Land. Lala Land is a very beautiful country that is located on a coordinate line. Lala Land is famous with its apple trees growing everywhere.Lala Land has exactly n apple trees. Tre...原创 2020-01-19 17:38:55 · 246 阅读 · 0 评论 -
CodeForces - 546B Soldier and Badges
Colonel has n badges. He wants to give one badge to every of his n soldiers. Each badge has a coolness factor, which shows how much it’s owner reached. Coolness factor can be increased by one for the ...原创 2020-01-17 16:58:33 · 206 阅读 · 0 评论 -
Equidistant String
Equidistant StringLittle Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of...原创 2020-01-17 16:06:26 · 260 阅读 · 0 评论 -
acm训练
B. Minimize the Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation of length n. Recall that the permutatio...原创 2020-01-13 19:28:47 · 254 阅读 · 0 评论 -
ACM
B. Interesting drinktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasiliy likes to rest after a hard work, so you may often meet him in som...原创 2019-12-31 14:54:51 · 203 阅读 · 0 评论 -
ACM专题训练--DP
1.P2001 硬币的面值题意:就是用所给的硬币凑出所有不超过m的数,因而数组中一定要有1的存在,没有1的话则不可能完成。#include<bits/stdc++.h>using namespace std;const int maxn = 2000010;const int INF = 0x3f3f3f3f; long long n, m, a[maxn];int m...原创 2019-12-28 23:05:01 · 212 阅读 · 0 评论 -
ACM训练
1.只含有4和7的数字是Luck number,能被Luck number整除的数字是almost luck number,给出一个数,看他是不是almost luck number。2.给长度为n的序列,求一个最短子序列,使它的和大于剩下的序列的和。(1<=n<=100)解法:求出序列的和,然后将序列从大到小排列,从前往后遍历,没找到符合大于sum/2的解就把答案加一,当找到符合...原创 2019-12-28 22:18:41 · 209 阅读 · 0 评论 -
ACM训练
Jamie and Alarm SnoozeJamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. However, he hates waking up, so he wants to make waking up less painful by setting the alar...原创 2019-12-21 23:25:30 · 259 阅读 · 0 评论 -
Maximum Product UVA-11059
Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of the maximum positive product involving consecutive terms of S. If you cannot find a positive sequence, ...原创 2019-12-16 17:03:21 · 137 阅读 · 0 评论 -
Division UVA725
Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0through 9 once each, such that the first number divided by the second is equal to an integer N, ...原创 2019-12-16 15:30:20 · 128 阅读 · 0 评论 -
ACM英文
be composed of 由。。。组成diagram 图表,图解+形容词adjacent 邻近的,毗连的名词prime 素数原创 2019-12-20 18:39:43 · 193 阅读 · 0 评论 -
n皇后问题
我们都知道国际象棋的规则,皇后可以吃到这一行,列,对角线上的所有棋子,有一天,JY给了皇后超能力,让她可以变出无限个一模一样的自己。但是有个条件,皇后不能吃掉自己,皇后想,那么我可以变出多少个自己呢?JY告诉她当然是n个,她又疑惑了,n个自己在棋盘上有多少种摆放的方式呢?在n*n的棋盘中放置n个皇后,使他们每行,每列,每个对角线上只有一个棋子,一共有多少种方法呢?一个想法就是用col【x】表示...原创 2019-12-17 10:59:36 · 133 阅读 · 0 评论 -
全排列生成算法
JY和女朋友一起去看星星,突然发现一排特别美丽的星星,JY有一双睿智的眼睛,他发现这些星星虽然看起来很像,但是都有细微的差别:有的星星是长方体,有的是球体,有的居然是懒羊羊头发的形状!他把这一发现告诉女朋友,女朋友说,我要你向我展示这些星星所有的排列方式,你才是真的爱我!这哪里能难得倒JY呢,他立马就想到了一些很好的算法:算法一:JY用一个盒子来装这些星星,当然这个盒子的方格子都是有顺序的。...原创 2019-12-16 22:27:36 · 157 阅读 · 0 评论 -
子集生成
怎样输出一个集合所有的子集呢原创 2019-12-16 20:13:58 · 191 阅读 · 0 评论