HDU 6058

 #pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define LL long long
#define mod 1000000007
using namespace std;
int t;
int a[];
int l[];
int r[];
int n,k;
int main()
{
scanf("%d",&t);
for(int i=;i<=t;i++){
LL ans=;
scanf("%d %d",&n,&k);
for(int j=;j<n;j++)
scanf("%d",&a[j]);
for(int j=;j<n;j++){
int s,t;
int c1=,c2=;
for(s=j+;s<n;s++){
if(c1>k)
break;
if(a[s]>a[j])
r[c1++]=s-j;
}
if(s>=n)
r[c1]=n-j;
for(t=j-;t>=;t--){
if(c2>k)
break;
if(a[t]>a[j])
l[c2++]=j-t;
}
if(t<=)
l[c2]=j+;;
for(int o=;o<c2;o++){
if(k-o->=c1)
continue;
ans=ans+1LL*a[j]*(l[o+]-l[o])*(r[k-o]-r[k-o-]);
}
}
printf("%lld\n",ans);
}
return ;
}

HDU 6060

 #pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define LL long long
#define mod 1000000007
using namespace std;
int n,k;
struct node
{
int st,ed;
LL w;
}N[];
int pre[];
LL www[];
int dp[]; int nedge=;
void init()
{
nedge=;
memset(pre,,sizeof(pre));
memset(www,,sizeof(www));
memset(dp,,sizeof(dp));
memset(N,,sizeof(N));
}
void add(int s,int t,LL we)
{
nedge++;
N[nedge].ed=t;
N[nedge].w=we;
N[nedge].st=pre[s];
pre[s]=nedge;
}
int dfs(int root ,int fa)
{
dp[root]=;
for(int i=pre[root];i;i=N[i].st)
{
if(N[i].ed!=fa){
www[N[i].ed]=N[i].w;
dp[root]+=dfs(N[i].ed,root);
}
}
return dp[root];
}
int main()
{
while(scanf("%d %d",&n,&k)!=EOF){
int a,b;
LL c;
init();
for(int i=;i<n;i++){
scanf("%d %d %lld",&a,&b,&c);
add(a,b,c);
add(b,a,c);
}
dfs(,-);
LL ans=;
for(int i=;i<=n;i++)
{
ans=ans+1LL*min(dp[i],k)*www[i];
}
printf("%lld\n",ans);
}
return ;
}

HDU 6063

 #pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define LL long long
#define mod 1000000007
using namespace std;
LL n,k;
LL fun(LL n,LL k){
LL ans=;
LL b=n;
while(k){
if(k%==){
ans=(ans*b)%mod;
}
k/=;
b=b%mod;
b=(b*b)%mod;
}
return ans;
}
int main()
{
int t=;
while(scanf("%lld %lld",&n,&k)!=EOF){
printf("Case #%d: %lld\n",++t,fun(n,k));
}
return ;
}

HDU 6066

 #pragma comment(linker, "/STACK:102400000,102400000")
#include <bits/stdc++.h>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <string>
#include <complex>
#define LL long long
#define mod 1000000007
using namespace std;
int t;
int main()
{
int ans,exm;
scanf("%d",&t);
ans=;
for(int i=; i<=t; i++)
{
scanf("%d",&exm);
if(exm<=)
ans++;
}
printf("%d\n",ans);
return ;
}

2017 Multi-University Training Contest - 3的更多相关文章

  1. 2017 Wuhan University Programming Contest (Online Round) Lost in WHU 矩阵快速幂 一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开。

    /** 题目:Lost in WHU 链接:https://oj.ejq.me/problem/26 题意:一个无向图,求从1出发到达n最多经过T条边的方法数,边可以重复经过,到达n之后不可以再离开. ...

  2. 2017 Wuhan University Programming Contest (Online Round) C. Divide by Six 分析+模拟

    /** 题目:C. Divide by Six 链接:https://oj.ejq.me/problem/24 题意:给定一个数,这个数位数达到1e5,可能存在前导0.问为了使这个数是6的倍数,且没有 ...

  3. 2017 Wuhan University Programming Contest (Online Round) B Color 树形dp求染色方法数

    /** 题目:Color 链接:https://oj.ejq.me/problem/23 题意:给定一颗树,将树上的点最多染成m种颜色,有些节点不可以染成某些颜色.相邻节点颜色不同.求染色方法数. 思 ...

  4. 2017 Wuhan University Programming Contest (Online Round) D. Events,线段树区间更新+最值查询!

    D. Events 线段树区间更新查询区间历史最小值,看似很简单的题意写了两天才写出来. 题意:n个数,Q次操作,每次操作对一个区间[l,r]的数同时加上C,然后输出这段区间的历史最小值. 思路:在线 ...

  5. 2017 Multi-University Training Contest - Team 9 1005&&HDU 6165 FFF at Valentine【强联通缩点+拓扑排序】

    FFF at Valentine Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  6. 2017 Multi-University Training Contest - Team 9 1004&&HDU 6164 Dying Light【数学+模拟】

    Dying Light Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Tot ...

  7. 2017 Multi-University Training Contest - Team 9 1003&&HDU 6163 CSGO【计算几何】

    CSGO Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Subm ...

  8. 2017 Multi-University Training Contest - Team 9 1002&&HDU 6162 Ch’s gift【树链部分+线段树】

    Ch’s gift Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

  9. 2017 Multi-University Training Contest - Team 9 1001&&HDU 6161 Big binary tree【树形dp+hash】

    Big binary tree Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  10. 2017 Multi-University Training Contest - Team 1 1003&&HDU 6035 Colorful Tree【树形dp】

    Colorful Tree Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)T ...

随机推荐

  1. [转载]GB2312简体中文编码表

    编码表源地址:http://www.knowsky.com/resource/gb2312tbl.htm编码在线查询:http://www.qqxiuzi.cn/bianma/zifuji.phpGB ...

  2. Scrum Meeting 11.04

    成员 今日任务 明日计划 用时 徐越 学习Fragment相关知识,代码移植 代码移植 4h 赵庶宏 selvet移植,服务器配置,编写数据库 服务器配置,代码移植 4h 薄霖 学习安卓界面设计数据库 ...

  3. 团队项目-NABCD

    用户需求分析与NABCD 模拟经营类(SIM)游戏:玩家模拟经营一家软件公司,平台初步定为Android. Need需求 任何一款游戏都要有自己的定位和目标群体,这些 iiMediaResearch数 ...

  4. 项目Beta冲刺(团队)第三天

    1.昨天的困难 记住密码打勾之后点击登录记住密码这四个字会变成省略号 点赞点击以后本应该呈现的爱心形状变成了方块 2.今天解决的进度 成员 进度 陈家权 私信模块探索ing,回复详情界面设计 赖晓连 ...

  5. Codeforces Round #182 (Div. 1) B. Yaroslav and Time 最短路

    题目链接: http://codeforces.com/problemset/problem/301/B B. Yaroslav and Time time limit per test2 secon ...

  6. DPDK L3fwd 源码阅读

    代码部分 整个L3fwd有三千多行代码,但总体思想就是在L2fwd的基础上,增加网络层的根据 IP 地址进行路由查找的内容. main.c 文件 int main(int argc, char **a ...

  7. Week2-作业1

    第一章:引用:如果一架民用飞机上有一个功能,用户使用它的概率是百万分之一,你还要做这个功能么?      选择之后,这个功能是什么呢?谜底是飞机的安全功能.        个人认为,飞机的安全功能这个 ...

  8. 调整Linux的最大文件打开数

    要调整一下Linux的最大文件打开数,否则squid在高负载时执行性能将会很低.另外,在Linux下面部署应用时,有时候会遇上 Socket/File:Can’t open so many files ...

  9. Shopping Bands Rank & SBR

    Shopping Bands Rank SBR https://www.guiderank.org/index.html Nike Air Zoom Pegasus 34 http://www.shi ...

  10. document.execCommand & contenteditable

    document.execCommand & contenteditable https://developer.mozilla.org/zh-CN/docs/Web/API/Document ...