A题  Mishka and Game

水。。随便统计一下就A了

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

 int main()
 {
     ,cnt2 = ;
     scanf("%d",&n);
     ; i < n; i++)
     {
         scanf("%d%d",&x,&y);
         if(x > y)
             cnt1++;
         else if(x < y)
             cnt2++;
     }
     if(cnt1 > cnt2)
         printf("Mishka\n");
     else if(cnt1 < cnt2)
         printf("Chris\n");
     else
         printf("Friendship is magic!^^\n");
     ;
 }

B题  Mishka and trip

题目大意:有n个城市,1-2-3-...-n-1连接,然后有k个首都,每个首都和每个城市都有一条路相连。但是,每两座城市直接最多只有一条路。每条路的权值,等于两个城市的魅力值乘积。问你所有路的权值之和是多少。

思路比较重要。这种类似的题型做过两三次了吧。

 #include <cstdio>
 #include <map>
 #include <set>
 #include <queue>
 #include <cstring>
 #include <algorithm>
 #include <iostream>
 #include <cmath>
 using namespace std;
 typedef long long LL;
 const int INF = 0x3f3f3f3f;
 #define mem0(x) memset(x,0,sizeof(x))
 #define mem1(x) memset(x,-1,sizeof(x))
  + ;
 int c[maxn], vis[maxn];
 int main()
 {
     mem0(vis);
     int n,k;
     scanf("%d%d",&n,&k);
     LL sum = , ans = ;
     ; i <= n; i++)
         scanf("%d",&c[i]), sum += c[i];

     ; i < k; i++)
     {
         int x;
         scanf("%d",&x);
         sum -= (LL)c[x];
         ans += (LL)c[x] * sum;
         vis[x] = ;
     }
     c[n+] = c[], vis[n+] = vis[];
     ; i <= n; i++)
     {
         ])
         ans += (LL)c[i] * c[i+];
     }
     printf("%lld\n",ans);

     ;
 }

C题  Chris and Road

这道题毫无头绪。。。

D题  Mishka and Interesting sum

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

  1. Codeforces Round #365 (Div. 2) C - Chris and Road 二分找切点

    // Codeforces Round #365 (Div. 2) // C - Chris and Road 二分找切点 // 题意:给你一个凸边行,凸边行有个初始的速度往左走,人有最大速度,可以停 ...

  2. Mishka and Divisors[CodeForces Round #365 Div.2]

    http://codeforces.com/contest/703/problem/E 题意:给定一个最多个数的序列,从中选出最少个数的数字,使得他们的乘积是k的倍数,若有多种选择方式,输出选出数字和 ...

  3. Codeforces Round #365 (Div. 2)-D Mishka and Interesting sum(树状数组)

    题目链接:http://codeforces.com/contest/703/problem/D 思路:看了神犇的代码写的... 偶数个相同的数异或结果为0,所以区间ans[l , r]=区间[l , ...

  4. Codeforces Round #365 (Div. 2) A 水

    A. Mishka and Game time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  5. Codeforces Round #365 (Div. 2) D. Mishka and Interesting sum 离线+线段树

    题目链接: http://codeforces.com/contest/703/problem/D D. Mishka and Interesting sum time limit per test ...

  6. Codeforces Round #365 (Div. 2) D. Mishka and Interesting sum (离线树状数组+前缀xor)

    题目链接:http://codeforces.com/contest/703/problem/D 给你n个数,m次查询,每次查询问你l到r之间出现偶数次的数字xor和是多少. 我们可以先预处理前缀和X ...

  7. Codeforces Round #365 (Div. 2) E - Mishka and Divisors(转化成01-背包)

    http://codeforces.com/contest/703/problem/E 题意: 给出n个数和一个k,计算出至少要多少个数相乘才是k的倍数. 思路:这道题目参考了杭电大神的代码http: ...

  8. Codeforces Round #365 (Div. 2) D - Mishka and Interesting sum(离线树状数组)

    http://codeforces.com/contest/703/problem/D 题意: 给出一行数,有m次查询,每次查询输出区间内出现次数为偶数次的数字的异或和. 思路: 这儿利用一下异或和的 ...

  9. Codeforces Round #365 (Div. 2) B - Mishka and trip

    http://codeforces.com/contest/703/problem/B 题意: 每个点都有一个值,每条边的权值为这两个点相乘.1~n成环.现在有k个城市,城市与其他所有点都相连,计算出 ...

  10. Codeforces Round #365 (Div. 2) A

    Description Mishka is a little polar bear. As known, little bears loves spending their free time pla ...

随机推荐

  1. MySQL中日期与时间类型

    http://blog.sina.com.cn/s/blog_4d8730df01014jiy.html

  2. 个人学习记录1:二维数组保存到cookie后再读取

    二维数组保存到cookie后再读取 var heartsArray = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0],[0,0, ...

  3. ajax 的返回值类型

    ajax的dataType类型有三种:text,json,xml. text类型: 主页面: $.ajax({   url:"chuli.php",   dataType:&quo ...

  4. [nginx学习之道]linux的nginx安装

    准备:首先要安装下一些gcc库用于编译 和一些nginx的扩展lib包: [root@localhost nginx-]# yum -y install gcc gcc-c++ autoconf au ...

  5. PHP的大括号(花括号{})使用详解

    一.不管什么程序,function name(){}, for(){}, ….这太多了,不说也知道什么用了. 二.$str{4}在字符串的变量的后面跟上{}大括号和中括号[]一样都是把某个字符串变量当 ...

  6. 主流浏览器css兼容问题的总结

    最近又搞了一波网站的兼容,由于要求ie浏览器还是要兼容到ie8,所以调起来还是各种蛋疼. 现在就post一些做兼容的总结,可能不够全面,但是可以告诉大家如何避过一些坑.主要测试了chrome,fire ...

  7. HFS远程命令执行漏洞入侵抓鸡黑阔服务器

    先来科普一下: HFS是什么? hfs网络文件服务器 2.3是专为个人用户所设计的HTTP档案系统,如果您觉得架设FTP Server太麻烦,那么这个软件可以提供您更方便的网络文件传输系统,下载后无须 ...

  8. [转]spring beans.xml

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  9. ServletConfig 可以做啥

    1.获得 servlet配置的servletname 2.获得servlet 配置的  getInitParameter("keyname") 3.获得servlet配置的 所有的 ...

  10. CodeViz代码可视化

    安装可以参见,http://blogimg.chinaunix.net/blog/upfile2/091119203927.pdf 结合pdf教程,这里说下注意事项: 1 ) 必须先安装GRAPHVI ...