这场是午夜场,发现学长们都睡了,改主意不打了,第二天起来打的virtual contest。

A题 http://codeforces.com/problemset/problem/701/A

巨水无比,好像三四分钟就直接A了。。。直接n²暴力。

 #include <cstdio>
 #include <map>
 #include <queue>
 #include <cstring>
 #include <algorithm>
 #include <iostream>
 using namespace std;
 #define mem0(x) memset(x,0,sizeof(x))
 #define mem1(x) memset(x,-1,sizeof(x))
 typedef long long LL;
 const int INF = 0x3f3f3f3f;

 ],vis[];
 int main()
 {
     ;
     scanf("%d",&n);
     ;i<=n;i++)
         scanf("%d",&a[i]),tot += a[i];
      / n;
     mem0(vis);
     ;i<=n;i++)
     {
         ) continue;
         vis[i] = ;
         ;j<=n;j++)
         {
              && a[i] + a[j] == need)
             {
                 printf("%d %d\n",i,j);
                 vis[j] = ;
                 break;
             }
         }
     }
     ;
 }

B题  http://codeforces.com/problemset/problem/701/B

其实挺简单的,就是一开始想错了,像不像八皇后!搞得我想错了= =。

其实是一道数学题,直接V数组和C数组记录一下行和列,推个公式直接AC。

如果说要注意什么地方的话,应该是这几个longlong.

long long tot = (LL)n * n -(LL)(rec_c + rec_r) * n + (LL)(rec_c) * rec_r;

还有一个技巧!输出答案的技巧,可以简化你的代码量,程序员总是懒的,能省一点是一点。

;i<m;i++)
{
         printf()?'\n':' ');
}
 #include <cstdio>
 #include <map>
 #include <queue>
 #include <cstring>
 #include <algorithm>
 #include <iostream>
 using namespace std;
 #define mem0(x) memset(x,0,sizeof(x))
 #define mem1(x) memset(x,-1,sizeof(x))
 typedef long long LL;
 const int INF = 0x3f3f3f3f;
 +;
 int r[maxn],c[maxn];
 LL ans[maxn];
 int main()
 {
     int n,m,x,y;
     scanf("%d%d",&n,&m);
     , rec_c = ;
     ;i<m;i++)
     {
         scanf("%d%d",&x,&y);
         )
             rec_r++;
         )
             rec_c++;
         r[x] = ;
         c[y] = ;
         long long tot = (LL)n * n -(LL)(rec_c + rec_r) * n + (LL)(rec_c) * rec_r;
         ans[i] = tot;
     }
     ;i<m;i++)
     {
         printf()?'\n':' ');
     }
     ;
 }

C题!尺取法!一个技巧!知道这个方法的话,这道题就是模板题了,233333.在那个《挑战程序设计竞赛》这本书3.2里头。

 #include <cstdio>
 #include <set>
 #include <map>
 #include <algorithm>
 #include <iostream>
 using namespace std;
 +];
 int main()
 {
     int p;
     scanf("%d",&p);

     set<char>all;

     getchar();
     ;i<p;i++)
         scanf("%c",&a[i]),all.insert(a[i]);

     int n = all.size();

     , t = , num =;
     map<int, int>cnt;
     int res = p;
     for(;;)
     {
         while(t<p&&num<n)
         {
             )
                 num++;
         }
         if(num < n) break;
         res  = min(res, t - s);
         )
             num--;
     }
     printf("%d\n",res);
     ;
 }

D题http://codeforces.com/contest/701/problem/D

题目大意:距离为l,有n个人,人行走速度为v1,有一辆限载k人的车,车速为v2,问最短到达目的地时间。(每个人只能乘车一次)

关键点:若要时间最短,便要每个人乘车时间相同。

然后推公式就行了。

t1是行走时间,t2是乘车时间。t3是汽车空车返回的时间。

有一个重要的等式是:一个人行走的时间不仅是t1,也可以是(m-1)*(t2 + t3)。t3=t2*(v2-v1)/(v2+v1)

 #include <cstdio>
 #include <iostream>
 using namespace std;

 int main()
 {
     double n, l, v1, v2, k, t1, t2, t;
     scanf("%lf%lf%lf%lf%lf", &n, &l, &v1, &v2, &k);
     ) / k;
     t2 = l / (v2 + v1 * (m - ) * ( * v2) / (v1 + v2));
     t = t2 + (l - t2 * v2) / v1;
     printf("%.10lf\n", t);
     ;
 }

Codeforces Round #364 (Div. 2)的更多相关文章

  1. Codeforces Round #364 (Div.2) D:As Fast As Possible(模拟+推公式)

    题目链接:http://codeforces.com/contest/701/problem/D 题意: 给出n个学生和能载k个学生的车,速度分别为v1,v2,需要走一段旅程长为l,每个学生只能搭一次 ...

  2. Codeforces Round #364 (Div.2) C:They Are Everywhere(双指针/尺取法)

    题目链接: http://codeforces.com/contest/701/problem/C 题意: 给出一个长度为n的字符串,要我们找出最小的子字符串包含所有的不同字符. 分析: 1.尺取法, ...

  3. 树形dp Codeforces Round #364 (Div. 1)B

    http://codeforces.com/problemset/problem/700/B 题目大意:给你一棵树,给你k个树上的点对.找到k/2个点对,使它在树上的距离最远.问,最大距离是多少? 思 ...

  4. Codeforces Round #364 (Div. 2) B. Cells Not Under Attack

    B. Cells Not Under Attack time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  5. Codeforces Round #364 (Div. 2) Cells Not Under Attack

    Cells Not Under Attack 题意: 给出n*n的地图,有给你m个坐标,是棋子,一个棋子可以把一行一列都攻击到,在根据下面的图,就可以看出让你求阴影(即没有被攻击)的方块个数 题解: ...

  6. Codeforces Round #364 (Div. 2) Cards

    Cards 题意: 给你n个牌,n是偶数,要你把这些牌分给n/2个人,并且让每个人的牌加起来相等. 题解: 这题我做的时候,最先想到的是模拟,之后码了一会,发现有些麻烦,就想别的方法.之后发现只要把它 ...

  7. Codeforces Round #364 (Div. 2)->A. Cards

    A. Cards time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...

  8. Codeforces Round #364 (Div. 2) E. Connecting Universities

    E. Connecting Universities time limit per test 3 seconds memory limit per test 256 megabytes input s ...

  9. Codeforces Round #364 (Div. 2) C.They Are Everywhere

    C. They Are Everywhere time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

随机推荐

  1. Beta阶段第二次Scrum Meeting

    此文章已于 2:51:42 2016/12/8 重新发布到 buaa_overwatch Beta阶段第二次Scrum Meeting 情况简述 BETA阶段第二次Scrum Meeting 敏捷开发 ...

  2. ionic 界面数据缓存问题

    在ionic开发过程中列表到详情,在返回是可能存在,列表重新加载问题,不能回到用户上次点击的地方 在处理前期各种坑,把详情设置为弹出层,缓存数据等等,然而会出现各种问题,无意间发现一篇文章,一个属性解 ...

  3. python基础3(元祖、字典、深浅copy、集合、文件处理)

    本次内容: 元祖 字典 浅copy和深copy 集合 文件处理 1.1元祖 元祖(tuple)与列表类似,不同之处在于元祖的元素不能修改,元祖使用小括号(),列表使用方括号[].元祖创建很简单,只需要 ...

  4. 调整Virtual Box硬盘大小

    我在Mac下使用Virtual Box安装Win7的虚拟机.因为之前装过Win7的32位版.现在因为机器内存升到8G,就可以划出4G来支持Win7虚拟机.所以就重新安装了Win7的64位版.在创建虚拟 ...

  5. [Head First设计模式]一个人的平安夜——单例模式

    系列文章 [Head First设计模式]山西面馆中的设计模式——装饰者模式 [Head First设计模式]山西面馆中的设计模式——观察者模式 [Head First设计模式]山西面馆中的设计模式— ...

  6. yaf设置命名空间

    修改yaf配置文件 文件是:yaf.ini extension=yaf.so yaf.use_namespace=1 index文件. 目录是application/controllers/Index ...

  7. PHP图片上传类

    前言 在php开发中,必不可少要用到文件上传,整理封装了一个图片上传的类也很有必要. 图片上传的流程图 一.控制器调用 public function upload_file() { if (IS_P ...

  8. ASP.NET 实现登陆验证

    public class ValidModule : IHttpModule { /// <summary> /// 您将需要在网站的 Web.config 文件中配置此模块 /// 并向 ...

  9. html页面的CSS、DIV命名规则

    CSS命名规则 头:header 内容:content/containe 尾:footer 导航:nav 侧栏:sidebar 栏目:column 页面外围控制整体布局宽度:wrapper 左右中:l ...

  10. 问题--feed列表有新闻重复的问题

    1. 经常有运营反应,客户端展示的feed列表有重复的问题. 重复问题分为两种,一种是两条新闻标题类似,另一种是两条新闻标题是完全相同. (1)标题类似 原来过滤的逻辑,是两个标题完全相等,才认为两条 ...