牛客多校第五场 A digits 2 签到】的更多相关文章

题意: 给定一个n,输出一个数,要求这个数所有位之和整除n,并且这个数也整除n,并且位数不许多于1e4 题解: 把这个数n输出n遍. #include<iostream> using namespace std; int main(){ int t; scanf("%d",&t); while(t--){ int q; scanf("%d",&q); ;i<=q;i++)printf("%d",q); print…
链接:https://www.nowcoder.com/acm/contest/143/F来源:牛客网 题目描述 Kanade has n boxes , the i-th box has p[i] probability to have an diamond of d[i] size. At the beginning , Kanade has a diamond of 0 size. She will open the boxes from 1-st to n-th. When she op…
链接:https://www.nowcoder.com/acm/contest/143/J 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 There are n students going to travel. And hotel has two types room:double room and triple room. The price of a double…
链接:https://www.nowcoder.com/acm/contest/143/D来源:牛客网 题目描述 Kanade has an even number n and a permutation b of all of the even numbers in [1,n] Let a denote an array [1,3,5....n-1] , now you need to find a permutation of [1,n] satisfy both a and b are s…
链接:https://www.nowcoder.com/acm/contest/143/F来源:牛客网 Kanade has n boxes , the i-th box has p[i] probability to have an diamond of d[i] size. At the beginning , Kanade has a diamond of 0 size. She will open the boxes from 1-st to n-th. When she open a…
链接:https://www.nowcoder.com/acm/contest/143/E来源:牛客网 Nowcoder University has 4n students and n dormitories ( Four students per dormitory). Students numbered from 1 to 4n. And in the first year, the i-th dormitory 's students are (x1[i],x2[i],x3[i],x4[…
比赛的时候脑瘫了没想出来..打多校以来最自闭的一场 显然从s中选择大于m个数组成的数必然比t大,所以只要dp求出从s中选择m个数大于t的方案数 官方题解是反着往前推,想了下反着推的确简单,因为高位的数优先级高,如果高位满足条件,那么低位只要用组合数求一下就行 #include<bits/stdc++.h> using namespace std; #define maxn 3005 #define ll long long #define mod 998244353 int n,m; char…
https://www.nowcoder.com/acm/contest/143/I vc-dimension 题解:分三种情况,组合数学算一下,其中一种要用树状数组维护 技巧(来自UESTC):1.循环技巧i主j滑 2.树状数组:一个数列从左到右分别维护某个元素左边比它大num的与右边比他大的num时,从上往下扫, 对每个点的x坐标离散化累加1到X轴上,然后就会发现sum(p[i].x-1)就是左边比它大的,i-1-sum(p[i])就是右边比它大的. 注意y相同的点,需要一起更新(我已开始一…
题意: 给出a数组的排列.求出字典序第k小的b数组的排列,满足1<=bi<=n,bi<bi+1,a[b[i]]<a[b[i+1]],m>0. 题解: 用树状数组倒着求出以每个数为首的递增子序列个数.若总的个数之和小于k则输出-1. 总的个数可能非常大而k<=1e18.所以要判下上界. 最后从1~n扫一遍.当前数大于上一个加入答案的数时,若以它为首的递增子序列个数小于k,则用k减去那个个数,否则将这个数加入答案并将k-1(即减去后面不再加数的情况). k = 0时跳出循环…
题意: 一共有n个宿舍,每个宿舍有4个人.给出第一年的人员分布和第二年的人员分布,问至少有多少人需要移动. 题解: 对于第一年的每个宿舍,向今年的每种组合连边.流量为1,费用为(4 - 组合中已在该宿舍的人数). 最后跑一边费用流. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; const int INF = 0x3f3f3f3f; int n, k; ], y[]; ][]; typedef pai…