
ACM_排列组合
文章平均质量分 76
深海沧澜夜未央
这个作者很懒,什么都没留下…
展开
-
next_permutation(全排列算法)
STL提供了两个用来计算排列组合关系的算法,分别是next_permutation和prev_permutation。首先我们必须了解什么是“下一个”排列组合,什么是“前一个”排列组合。考虑三个字符所组成的序列{a,b,c}。 这个序列有六个可能的排列组合:abc,acb,bac,bca,cab,cba。这些排列组合根据less-than操作符做字典顺序(lexicograp原创 2018-01-20 21:11:13 · 420 阅读 · 1 评论 -
Water Gate Management(二进制枚举组合排列模板 n个数的子集)
A dam has n water gates to let out water when necessary. Each water gate has its own capacity, water path and affected areas in the downstream. The affected areas may have a risk of flood when the wa原创 2017-05-01 15:17:44 · 524 阅读 · 0 评论 -
Morse Code HNUST 1675(字符串全排列 递归解决 数组a[]与流输入的缓慢)
题目描述 摩尔斯电码(英语:Morse Code)是一种时通时断的信号代码,通过不同的排列顺序来表达不同的英文字母、数字和标点符号。是由美国人萨缪尔·摩尔斯在1836年发明。 --摘自维基百科原创 2017-12-09 16:48:04 · 359 阅读 · 0 评论 -
Codeforces Round #469 (Div. 2) D A Leapfrog in the Array
题意:给出1-n数字它们的位置都是奇数索引,之后最右边的数字填入空白索引,直至1-n数字之间无空白索引思路:对于一个询问q,如果q是奇数,那么答案就是(q-1)/2,否则将不断q=q/2+n即可 来源:http://blog.youkuaiyun.com/xiangAccepted/article/details/79506332#include <bits/stdc++.h> typedef ...原创 2018-03-10 20:49:24 · 187 阅读 · 0 评论 -
新疆大学ACM-ICPC程序设计竞赛五月月赛(同步赛) B 杨老师的游戏 (全排列枚举)
杨老师给同学们玩个游戏,要求使用乘法和减法来表示一个数,他给大家9张卡片,然后报出一个数字,要求大家用表达式的形式来表示出这个数100 可以表示为这样的形式:100 = 129*67-8543 , 还可以表示为:100 = 13*489-6257注意特征:表达式中,数字1~9分别出现且只出现一次(不包含0)。类似这样的表达式,100 有 20 种表示法。题目要求:从标准输入读入一个正整数N(N&l...原创 2018-05-02 10:49:26 · 225 阅读 · 0 评论 -
Kattis - hopscotch Hopscotc 组合数(逆元)
You’re playing hopscotch! You start at the origin and your goal is to hop to the lattice point (N,N)(N,N). A hop consists of going from lattice point (x1,y1)(x1,y1) to (x2,y2)(x2,y2), where x1<x2x1...原创 2018-07-25 10:44:53 · 364 阅读 · 0 评论 -
AtCoder Grand Contest 025 B - RGB Coloring 组合数
Time limit : 2sec / Memory limit : 1024MB Score : 700 points Problem Statement Takahashi has a tower which is divided into N layers. Initially, all the layers are uncolored. Takahashi is going to p...原创 2018-08-15 16:31:06 · 368 阅读 · 0 评论