这个题目说的是有n个人,有k辆巴士,有m天,每天都要安排n个人坐巴士(可以有巴士为空),为了使得这n个人不会成为朋友,只要每两个人在这m天里坐的巴士至少一天不相同即可. 要你求是否有这样的安排方法,如果有,输出具体的安排方案,每个人每天坐那辆车. 挺不错的题目,我压根没想到..真的,虽然知道之后惊呼原来如此简单,但一开始确实想岔了.现在一看这题目,很清晰,每个学生在这m天中坐的车辆,就会形成一个由m个数字组成的序列(数字为1-k代表巴士编号),按照题目要求,只需要学生的那个序列是独一无二的即可.…
先上题目+: C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a…
题目链接:http://codeforces.com/problemset/problem/459/C 题目意思:有 n 个 students,k 辆 buses.问是否能对 n 个students安排每一天搭乘的buses,使得没有两个student 在 d 天搭乘相同的buses,buses 的 容量没有限制,也就是它可以搭无限多的人. 做这条题的时候,我是得不出无解的条件的,看了 tutorial 之后一下子明白了,就是 k^d > n.很容易理解,因为每一天某个student可以选择的…
题目 跑个案例看看结果就知道了:8 2 3 题目给的数据是 n,k,d 相当于高中数学题:k个人中选择d个人排成一列,有多少种不同的方案数,列出其中n中就可以了. #include<iostream> #include<algorithm> #include<string> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h>…
题意:n个人,k辆车,要求d天内任意两人都不能一直在同一辆车,能做到给出构造,不能输出-1 思路:我们把某一个人这d天的车号看成一个d位的数字,比如 1 1 2 3代表第一天1号车.第二天1号车.第三天2号车.第四天3号车,那么就是求构造n个不相同的d位数,所以只要kd >= n,然后模拟加一 代码: #include<set> #include<map> #include<stack> #include<cmath> #include<queu…
E - Pashmak and Buses Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 459C Description Recently Pashmak has been employed in a transportation company. The company has k buses and has a c…
题目地址:http://codeforces.com/contest/459/problem/C C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The com…
C - Pashmak and Buses Codeforces Round #261 (Div. 2) C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The…
C. Pashmak and Buses time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently Pashmak has been employed in a transportation company. The company has k buses and has a contract with a school…
题目:codeforces 459D - Pashmak and Parmida's problem 题意:给出n个数ai.然后定义f(l, r, x) 为ak = x,且l<=k<=r,的k的个数.求 i, j (1 ≤ i < j ≤ n) ,f(1, i, ai) > f(j, n, aj).,有多少对满足条件的i.j. 分类:逆序数.线段树.离散化, 分析:这是一道不错的数据结构题目,比較灵活. 推一下第一组例子之后发现时让求一个逆序数的题目.可是不是单纯的求逆序数. 第一…