这里直接贴我的程序,题目和思路另翻博客

B. Sherlock and his girlfriend`//
//  main.cpp
//  journey
//
//  Created by zhangdenny on 2017/3/4.
//  Copyright © 2017年 Kirito. All rights reserved.
//
#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <locale>
#include  <memory>
#include  <cerrno>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <list>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define pb push_back
#define ll long long
using namespace std;
int n,m,t;
int main()
{cin>>t;if(t<=2)cout<<"1"<<endl;elsecout<<"2"<<endl;int j;for(int i=2;i<=t+1;i++){m=sqrt(i);for(j=2;j<=m;j++)if(i%j==0)break;if(j>m)cout<<"1 ";else cout<<"2 ";}return 0;
}`

C. Molly’s Chemicals

//
//  main.cpp
//  journey
//
//  Created by zhangdenny on 2017/3/4.
//  Copyright © 2017年 Kirito. All rights reserved.
//
#include  <functional>
#include  <algorithm>
#include  <exception>
#include  <stdexcept>
#include  <streambuf>
#include  <iterator>
#include  <string.h>
#include  <stdlib.h>
#include  <typeinfo>
#include  <valarray>
#include  <iostream>
#include  <sstream>
#include  <istream>
#include  <stdio.h>
#include  <climits>
#include  <clocale>
#include  <complex>
#include  <csetjmp>
#include  <csignal>
#include  <cstdarg>
#include  <cstddef>
#include  <ctype.h>
#include  <cassert>
#include  <cstdlib>
#include  <utility>
#include  <cstring>
#include  <numeric>
#include  <ostream>
#include  <cwctype>
#include  <fstream>
#include  <iomanip>
#include  <math.h>
#include  <bitset>
#include  <cctype>
#include  <string>
#include  <vector>
#include  <limits>
#include  <locale>
#include  <memory>
#include  <cerrno>
#include  <iosfwd>
#include  <cfloat>
#include  <cstdio>
#include  <cwchar>
#include  <cmath>
#include  <ctime>
#include  <deque>
#include  <queue>
#include  <stack>
#include  <list>
#include  <ios>
#include  <map>
#include  <set>
#include  <new>
#define fi first
#define se second
#define pb push_back
#define ll long long
using namespace std;
ll n,k,dq;
vector<ll> v;
ll x;
map<ll,int> mp;
ll ans;
int main()
{cin>>n>>k;dq=1;mp.clear();if (abs(k)==1){v.push_back(1);if (k==-1) v.push_back(-1);}else{while (dq<=1e14){v.push_back(dq);dq=dq*k;}}mp[0]=1;dq=0;for (int i=1;i<=n;++i){cin>>x;dq+=x;for (int j=0;j<v.size();j++)if (mp.count(dq-v[j])!=0)ans+=mp[dq-v[j]];mp[dq]+=1;}cout<<ans<<endl;return 0;
}

伸手党走开

转载于:https://www.cnblogs.com/NightRaven/p/9333254.html

Codeforces 776B 776C 程序(夏洛克专场)相关推荐

  1. 「花田对」CSDN程序员专场——谁来拯救技术宅!_豆瓣

    「花田对」CSDN程序员专场--谁来拯救技术宅!_豆瓣 「花田对」CSDN程序员专场--谁来拯救技术宅!

  2. 【codeforces 776B】Sherlock and his girlfriend

    [题目链接]:http://codeforces.com/contest/776/problem/B [题意] 给你n个物品, 第i个物品价值为i+1 让你给这n个物品着色; 如果a物品的价值x和b物 ...

  3. 学术讲座: 如何把科研变成兴趣 (程序猿专场)

    摘要: 科研是研究生和高校教师分内之事. 有些人做起来痛苦, 有些人做起来快乐, 还有些人做起来痛快. 本讲座讨论科研过程中如何培养学习能力.创新能力.表达能力.社交能力等. 从一些师生的案例出发, ...

  4. 一键打造全栈式小程序开发者!

    受访者 | 杨航 采访者 | 伍杏玲 出品 | CSDN(ID:CSDNnews) 自 2017 年 1 月 9 日,微信小程序诞生以来,各大巨头公司纷纷布局小程序,小程序进入快速发展期: 据即速应用 ...

  5. 程序员们平时都喜欢逛什么论坛呢?

    职业经理人 看到有人问程序员都喜欢逛哪些论坛,那我就来总结一下. 0. GitHub - 开发者最最最重要的网站:https://github.com 这个不用多说了吧,代码托管网站,上面有很多资源, ...

  6. 编程精粹 --Microsoft编写优质无错C程序秘诀

    献给我的妻子Beth, 以及我的双亲Joseph和Julia Maguire ────为了他们的爱和支持 序 1986年,在为几家小公司咨询和工作了10年之后为了获得编写Macintosh应用程序的经 ...

  7. 前后端实现Base64格式的传参及转换

    js开发过程中,有可能遇到参数传输出现乱码等问题,那么怎么解决这类问题呢?那就是对参数进行Base64编码,在传输完成后,在通过解码获取原参数值.为了实现这个功能,我们需要用到Base64.js,其源 ...

  8. 覆盖10亿设备,月活2亿,快应用要取代App?

    作者 | 伍杏玲 来源 | CSDN(ID:CSDNnews) 2017 年 1 月 9 日,微信小程序横空出世,紧接着支付宝小程序.百度智能小程序.今日头条小程序.12 大厂商联盟的快应用等布局小程 ...

  9. javascript中的Base64.UTF8编码与解码详解

    javascript中的Base64.UTF8编码与解码详解 本文给大家介绍的是javascript中的Base64.UTF8编码与解码的函数源码分享以及使用范例,十分实用,推荐给小伙伴们,希望大家能 ...

最新文章

  1. Pandas:透视表(pivotTab)和交叉表(crossTab)
  2. Infineon第九届汽车电子开发者大会宣传视频
  3. Python 操作Word文档插入图片和表格实例演示
  4. vnc远程桌面复制文件Linux,vncviewer远程桌面linux
  5. python异常值处理实例_利用Python进行异常值分析实例代码
  6. 用python设计学生管理系统_基于python和tkinter实现的一个简单的学生信息管理系统...
  7. 前端websocket获取数据后需要存本地吗_是什么让我放弃了Restful API?了解清楚后我全面拥抱GraphQL!...
  8. 活动目录管理之批量创建域用户
  9. 企业常用OSPF组网配置示例
  10. linux搭建windows无盘系统,Ubuntu系统搭建drbl无盘服务端环境
  11. JanusGraph图数据库系统简介
  12. api质量等级_API质量等级与机油选用指引
  13. 头号玩家VR跑步机KAT Walk Mini上市,支持各种主流VR头显
  14. 修改本机的 Host 文件
  15. 计算圆、圆球和圆锥的面积和体积
  16. nodejs中的__filename和__dirname的使用说明
  17. 国产手风琴的前生今世
  18. 火狐浏览器--由于不能验证所收到的数据是否可信
  19. 数据分析 | 数据可视化图表,BI工具构建逻辑
  20. 计算机考试试卷怎么做,雨课堂怎么新建试卷 雨课堂制作试题的方法

热门文章

  1. 【毕业季·进击的技术er】一个读研学生的唠唠嗑
  2. 【集合论】序关系 : 总结 ( 偏序关系 | 偏序集 | 可比 | 严格小于 | 覆盖 | 哈斯图 | 全序关系 | 拟序关系 | 偏序关系八种特殊元素 | 链 | 反链 ) ★★
  3. Unity 之 ShaderGraph 实现旋涡(传送门)效果入门级教程
  4. Qt网络资源汇总(官网、源码、社区、博客)
  5. L1-038 新世界 (5 分)C语言
  6. 说说dota、人生、程序(长篇、神经质)
  7. mysql 幕客网_Mysql(一)
  8. 呼叫中心运营管理的七点建议
  9. [绝对原创] AKM项目轶事之FLYBACK飞机晚点索赔
  10. DataPipeline亮相“2021科技助力湾区数字金融发展峰会”,解锁“实时数据管理”密码