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. Metasploit拿Shell

    进入metasploit系统 msfconsole Nmap端口扫描 nmap –sV IP(或者域名),如果机器设置有防火墙禁ping,可以使用nmap -P0(或者-Pn) –sV IP(或者域名 ...

  2. Vs2012 编写代码规则

    FxCop编写规则 VS2012 下更方便,所需的DLL在: D:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Static ...

  3. Flask之笔记集合

    目录 一.简述 二.基本使用 三.配置文件 四.路由系统 2.自定义正则路由 五.模版语言 六.请求和响应 七.Session 2.自定义session 八.蓝图 九.message 十.中间件 十一 ...

  4. Chapter 6 面向对象基础

    面向对象=对象+类+继承+通信,如果一个软件系统采用这些概念来建立模型并给予实现,那么它就是面向对象的.面向对象的软件工程方法是面向对象方法在软件工程领域的全面运用涉及到从面向对象分析.面向对象设计. ...

  5. sql索引的填充因子多少最好,填充因子有什么用

    和索引重建最相关的是填充因子.当创建一个新索引,或重建一个存在的索引时,你可以指定一个填充因子,它是在索引创建时索引里的数据页被填充的数量.填充因子设置为100意味着每个索引页100%填满,50%意味 ...

  6. C++课程 second work _1025

    传送门 Problem 题目不是特别难,只是跪在了最后一个测试点(已解决). 最后一个测试点= = 无效节点...无力ing

  7. android 的helloworld没跑起来 原因

    <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com. ...

  8. Internet History, Technology and Security (Week4)

    Week4. We are now moving into Week 4! This week, we will be covering commercialization and growth. T ...

  9. springboot maven

    更多信息请从官网获取https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE 1.parent基于自己项目而非spring-boot-starter- ...

  10. Eclipse下高亮显示Freemarker文件

    让eclipse高亮显示freemarker文件有两种方式,一种是安装JBoss的插件,一种是用JSP编辑器打开freemarker的文件.我使用第二种方式来完成. 打开eclipse,点击windo ...