nefu oj 986 林大的入学体检(运算符重载在排序中的运用)
2015-08-01 22:23
411 查看
sum=(sum+m
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.a+sum*m
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.b)%mod;对应描述当李华刚来到校医院时每个项目要排的时间为ai秒,如果他选择了其中一个项目先排队,那么对于其他的项目每秒增加额外排队时间为bi注意理解
还有 数组开小了就会RE =.=
P.S.本来是单组输入的题多组输入也能过~
bool cmp(time x,time y)
{
return x.a*y.b
}
CE,换了
struct time
{
long long a,b;
bool operator < (const time &other) const
{return a*other.b
}m[100005];
A了~~
全题代码如下
#include
#include
#include
#include
using namespace std;
const int mod=365*24*60*60;
struct time
{
long long a,b;
bool operator < (const time &other) const
{return a*other.b
}m[100005];
long long sum;
int main()
{
//freopen("data.in.txt","r",stdin);
intn,t;
while(~scanf("%d",&t))
{
for(int k=1;k<=t;k++)
{
scanf("%d",&n);
for(int i=0;i
sort(m,m+n);
sum=0;
for(int i=0;i
{
sum=(sum+m
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.a+sum*m
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.b)%mod;
}
printf("Case #%d: %I64d\n",k,sum);
}
}
return0;
}
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.a+sum*m
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.b)%mod;对应描述当李华刚来到校医院时每个项目要排的时间为ai秒,如果他选择了其中一个项目先排队,那么对于其他的项目每秒增加额外排队时间为bi注意理解
还有 数组开小了就会RE =.=
P.S.本来是单组输入的题多组输入也能过~
bool cmp(time x,time y)
{
return x.a*y.b
}
CE,换了
struct time
{
long long a,b;
bool operator < (const time &other) const
{return a*other.b
}m[100005];
A了~~
全题代码如下
#include
#include
#include
#include
using namespace std;
const int mod=365*24*60*60;
struct time
{
long long a,b;
bool operator < (const time &other) const
{return a*other.b
}m[100005];
long long sum;
int main()
{
//freopen("data.in.txt","r",stdin);
intn,t;
while(~scanf("%d",&t))
{
for(int k=1;k<=t;k++)
{
scanf("%d",&n);
for(int i=0;i
sort(m,m+n);
sum=0;
for(int i=0;i
{
sum=(sum+m
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.a+sum*m
![](http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/e6/weiboi_org.gif)
.b)%mod;
}
printf("Case #%d: %I64d\n",k,sum);
}
}
return0;
}
相关文章推荐
- div层调整zindex属性无效原因分析及解决方法
- thinkpad s3 安装win8 kali双系统笔记
- 正则表达式模板大全
- python爬虫(三)--Python的set()
- jsp、Servlet相关知识介绍(转)
- MongoDB中shell基本使用
- 第74讲:从Spark源码的角度思考Scala中的模式匹配学习笔记
- Swift 懒加载(lazy)
- MongoDB配置客户端
- c++中string的常用函数说明
- #第一周1005结题报告#
- hdu 2512 反素数 水题
- RocketMQ 源码分析
- MongoDB的启动
- RHEL7.0网卡设置
- Intellij idea 设置
- Linux常用命令001之ls、mkdir、cd、pwd、rmdir、rm、cp、mv、ln
- BootStray表单控件 基本控件的使用 提示,图标的交互
- Struts中Action三种接收参数的方式?
- 单据必填附件模板配置