http://www.lydsy.com/JudgeOnline/problem.php?id=3850

题意:类似国王游戏....无意义..

#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <sstream>
using namespace std;
typedef long long ll;
#define pb push_back
#define rep(i, n) for(int i=0; i<(n); ++i)
#define for1(i,a,n) for(int i=(a);i<=(n);++i)
#define for2(i,a,n) for(int i=(a);i<(n);++i)
#define for3(i,a,n) for(int i=(a);i>=(n);--i)
#define for4(i,a,n) for(int i=(a);i>(n);--i)
#define CC(i,a) memset(i,a,sizeof(i))
#define read(a) a=getint()
#define print(a) printf("%d", a)
#define dbg(x) cout << (#x) << " = " << (x) << endl
#define error(x) (!(x)?puts("error"):0)
#define rdm(x, i) for(int i=ihead[x]; i; i=e[i].next)
inline int getint() { static int r, k; r=0,k=1; static char c; c=getchar(); for(; c<'0'||c>'9'; c=getchar()) if(c=='-') k=-1; for(; c>='0'&&c<='9'; c=getchar()) r=r*10+c-'0'; return k*r; } const int N=1e5+10;
struct dat { int x, y; }a[N];
ll ans;
int n;
bool cmp(const dat &a, const dat &b) { return a.y*a.x+b.y*(a.x+b.x)<b.y*b.x+a.y*(a.x+b.x); }
int main() {
read(n);
rep(i, n) read(a[i].x);
rep(i, n) read(a[i].y);
sort(a, a+n, cmp); ll sum=0;
rep(i, n) sum+=a[i].x, ans+=sum*a[i].y;
cout << ans;
return 0;
}

  


300T就这样献给了这种水题TAT..

【BZOJ】3850: ZCC Loves Codefires(300T就这样献给了水题TAT)的更多相关文章

  1. BZOJ 3850: ZCC Loves Codefires【贪心】

    Though ZCC has many Fans, ZCC himself is a crazy Fan of a coder, called "Memset137". It wa ...

  2. 2014---多校训练2(ZCC Loves Codefires)

    ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Othe ...

  3. HDU-4882 ZCC Loves Codefires

    http://acm.hdu.edu.cn/showproblem.php?pid=4882 ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Ot ...

  4. HDU 4882 ZCC Loves Codefires (贪心)

    ZCC Loves Codefires 题目链接: http://acm.hust.edu.cn/vjudge/contest/121349#problem/B Description Though ...

  5. HDU 4882 ZCC Loves Codefires(贪心)

     ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  6. hdu 4882 ZCC Loves Codefires(数学题+贪心)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4882 ------------------------------------------------ ...

  7. 【BZOJ】【3850】ZCC Loves Codefires

    贪心 就跟NOIP2012国王游戏差不多,考虑交换相邻两题的位置,对其他题是毫无影响的,然后看两题顺序先后哪个更优.sort即可. WA了一次的原因:虽然ans开的是long long,但是在这一句: ...

  8. 2014 (多校)1011 ZCC Loves Codefires

    自从做了多校,整个人都不好了,老是被高中生就算了,题老是都不懂=-=原谅我是个菜鸟,原谅我智力不行.唯一的水题. Problem Description Though ZCC has many Fan ...

  9. BZOJ3850: ZCC Loves Codefires

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3850 题解:类似于国王游戏,推一下相邻两个元素交换的条件然后排个序就可以了. 代码: #inc ...

随机推荐

  1. .Net Attribute特性

    1.什么是Atrribute 首先,我们肯定Attribute是一个类,下面是msdn文档对它的描述: 公共语言运行时允许你添加类似关键字的描述声明,叫做attributes, 它对程序中的元素进行标 ...

  2. Eclipse常用快捷键与代码模板

    Eclipse常用快捷键汇总 Eclipse的编辑功能非常强大,掌握了Eclipse快捷键功能,能够大大提高开发效率.Eclipse中有如下一些和编辑相关的快捷键.1. [ALT+/]此快捷键为用户编 ...

  3. EtherCAT数据帧结构

    EtherCAT数据直接使用以太网数据帧(以太网帧解释http://blog.chinaunix.net/uid-23080322-id-118440.html)传输,使用的帧类型为0x88A4.Et ...

  4. discuz特殊主题插件开发步骤和犯的愚蠢错误

    discuz作为国内流行的论坛系统,可谓造福了不少趣味相投的网友们.它让天南地北.国内外有着共同兴趣爱好的人们聚集在一起,分享彼此的喜怒哀乐.心得体会.然而作为discuz的使用者之一,还是个码农,然 ...

  5. 【JAVA、C++】LeetCode 013 Roman to Integer

    Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 t ...

  6. Android之多线程断点下载

    本文主要包含多线程下载的一些简单demo,包括三部分 java实现 android实现 XUtils开源库实现 注意下载添加网络权限与SD卡读写权限 java实现多线程下载 public class ...

  7. ubuntu安装vmware tools

    1.选择虚拟机菜单栏--安装VMware tools 选择你装虚拟机下的目录,点击  Linux.iso 再重新点击安装VMware Tools 这样会弹出一个包VMwareTools-9.6.0-1 ...

  8. [转]使用VC/MFC创建一个线程池

    许多应用程序创建的线程花费了大量时间在睡眠状态来等待事件的发生.还有一些线程进入睡眠状态后定期被唤醒以轮询工作方式来改变或者更新状态信息.线程池可以让你更有效地使用线程,它为你的应用程序提供一个由系统 ...

  9. Linux下创建ftp用户并锁定根目录

    [root@d vsftpd]# vi /etc/vsftpd/chroot_list 加入要锁定根目录的ftp用户名(一行只能一个用户) [root@ vsftpd]# vi /etc/vsftpd ...

  10. 在Mac OS X 10.8中配置Apache + PHP + MySQL

    在Mac OS X 10.8中配置Apache+PHP+MySQL的内容包括: 配置Apache 配置PHP 安装MySQL 配置PHPAdmin 设置数据库默认字符集 一. 配置Apache 1. ...