博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【图论】[NOIP2014]联合权值
阅读量:4700 次
发布时间:2019-06-09

本文共 1451 字,大约阅读时间需要 4 分钟。

做完之后感觉 这个题应该是需要一些数学思想

题解看这个博客:

代码如下

#include
#include
#include
using namespace std; #define in = read(); typedef long long ll; typedef unsigned int ui; const ll size = 1000000 + 10000; struct point{ ll next,to,dis;}edge[size]; ui n; ui a[size]; ui site,ans,maxans; ui head[size];inline ll read(){ ll num = 0 , f = 1; char ch = getchar(); while(!isdigit(ch)){ if(ch == '-') f = -1; ch = getchar(); } while(isdigit(ch)){ num = num*10 + ch - '0'; ch = getchar(); } return num*f;}inline void add(ll x,ll y){ edge[++site].next = head[x]; edge[site].to = y; head[x] = site;}int main(){ n in; for(int i=1;i
max1){ max2 = max1; max1 = a[edge[j].to]; } else if(a[edge[j].to] > max2) max2 = a[edge[j].to]; ans = (ans + sum*a[edge[j].to])%10007; sum = (sum + a[edge[j].to])%10007; maxans = max(maxans , max1*max2); } } ans = (ans*2)%10007; printf("%d %d",maxans,ans);}//COYG

转载于:https://www.cnblogs.com/ars4me/p/7536162.html

你可能感兴趣的文章
Log4j知识汇总
查看>>
20120918-LIST类定义《数据结构与算法分析》
查看>>
《linux c编程指南》学习手记1
查看>>
【JavaScript】各种事件
查看>>
函数的动态参数和作用域
查看>>
Silver Cow Party
查看>>
css框模型、定位、浮动
查看>>
重载操作符解析(原)
查看>>
【转】PHP获取当前时间、时间戳的各种格式写法汇总[日期时间]
查看>>
仿百度手机助手标题栏透明度随ListView或ScrollView滚动改变的实现方法
查看>>
easyUI 如何不跳转页面,只是加载替换center部分内容
查看>>
BICEP单元测试——随机四则运算升级版
查看>>
TCP/IP,Http,Socket,XMPP的区别
查看>>
PL/SQL Developer-官网下载地址
查看>>
HDU1249_三角形切割平面
查看>>
mac osx 快捷键
查看>>
ASP.NET MVC下使用AngularJs语言(一):Hello your name
查看>>
java解析XML大全(转)
查看>>
移上显示大图
查看>>
凯撒密码、GDP格式化输出、99乘法表
查看>>