hdu 6066 RXD's date

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3
 4 int main(){
 5     int n,x;
 6     cin>>n;
 7     int s=0;
 8     while(n--){
 9         scanf("%d",&x);
10         if(x<=35) s++;
11     }
12     cout<<s<<endl;
13 }

hdu 6066 RXD's date

时间: 2024-08-25 08:35:14

hdu 6066 RXD's date的相关文章

HDU 6065 RXD, tree and sequence (LCA DP)

RXD, tree and sequence Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 234    Accepted Submission(s): 82 Problem Description RXD has a rooted tree T with size n, the root ID is 1, with the dep

HDU 6060 RXD and dividing(dfs 思维)

RXD and dividing Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1893    Accepted Submission(s): 809 Problem Description RXD has a tree T, with the size of n. Each edge has a cost.Define f(S) 

HDU 6060 RXD and dividing(LCA)

[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6060 [题目大意] 给一个n个节点的树,要求将2-n号节点分成k部分, 然后将每一部分加上节点1,求每个集合最小斯坦纳树的最大权值和. [题解] 我们按照后序遍历染色分组,得到的一定是最优分组, 现在考虑在不同颜色的虚树上求路径权值和, 我们发现每个点增加的权值是深度减去到根的路径上已被覆盖的长度, 这个长度等于与dfs序前继的LCA的深度,因此我们在搜索的同时计算与dfs序前继的LCA即可.

hdu 6060 RXD and dividing

思路:判断子树节点个数和k的最小值就好了,long long 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const int N=1e6+10; 5 6 int n,k; 7 vector<pair<int ,ll > > e[N]; 8 ll sum; 9 int a[N]; 10 void dfs(int u,int fa){ 11 a[u]=1; 12 for

hdu 6063 RXD and math

1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 const ll mod=1e9+7; 5 6 ll hh(ll x,ll y){ 7 ll s=1; 8 while(y){ 9 if(y&1) s=s*x%mod; 10 x=x*x%mod; 11 y>>=1; 12 } 13 return s; 14 } 15 int main(){ 16 int k=1; 17 ll

HDU 6065 RXD, tree and sequence (LCA+DP)

题意:给定上一棵树和一个排列,然后问你把这个排列分成m个连续的部分,每个部分的大小的是两两相邻的LCA的最小深度,问你最小是多少. 析:首先这个肯定是DP,然后每个部分其实就是里面最小的那个LCA的深度.很容易知道某个区间的值肯定是 [li, li+1] .. [ri-1, ri]这些区间之间的一个,并且我们还可以知道,举个例子,1 2 3 4  5 6 如果知道分成两部分 其中 2 和 6 是最优的,那么中间的 3 4 5 ,这三个数其实属于哪个区间都无所谓,所以对于第 i 个数只有三种可能.

HDU 6060 17多校3 RXD and dividing(树+dfs)

Problem Description RXD has a tree T, with the size of n. Each edge has a cost.Define f(S) as the the cost of the minimal Steiner Tree of the set S on tree T. he wants to divide 2,3,4,5,6,…n into k parts S1,S2,S3,…Sk,where ?Si={2,3,…,n} and for all d

HDU 3569 Imaginary Date 简单期望

推一下公式,就会发现是这个.. 因为设结果有x种方案.则每个数字出现的概率都均等,然后和就是x*m 每种方案的概率是1/x 每个数出现的概率都是1/n 所以每个方案的和就是 sum/n *m #include <cstring> #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; const int N = 1005; int main() { int n,

变形课(DFS hdu 1181)

变形课 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 19133    Accepted Submission(s): 6892 Problem Description 呃......变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规