Codeforces 776B 776C 程序(夏洛克专场)
这里直接贴我的程序,题目和思路另翻博客
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 程序(夏洛克专场)相关推荐
- 「花田对」CSDN程序员专场——谁来拯救技术宅!_豆瓣
「花田对」CSDN程序员专场--谁来拯救技术宅!_豆瓣 「花田对」CSDN程序员专场--谁来拯救技术宅!
- 【codeforces 776B】Sherlock and his girlfriend
[题目链接]:http://codeforces.com/contest/776/problem/B [题意] 给你n个物品, 第i个物品价值为i+1 让你给这n个物品着色; 如果a物品的价值x和b物 ...
- 学术讲座: 如何把科研变成兴趣 (程序猿专场)
摘要: 科研是研究生和高校教师分内之事. 有些人做起来痛苦, 有些人做起来快乐, 还有些人做起来痛快. 本讲座讨论科研过程中如何培养学习能力.创新能力.表达能力.社交能力等. 从一些师生的案例出发, ...
- 一键打造全栈式小程序开发者!
受访者 | 杨航 采访者 | 伍杏玲 出品 | CSDN(ID:CSDNnews) 自 2017 年 1 月 9 日,微信小程序诞生以来,各大巨头公司纷纷布局小程序,小程序进入快速发展期: 据即速应用 ...
- 程序员们平时都喜欢逛什么论坛呢?
职业经理人 看到有人问程序员都喜欢逛哪些论坛,那我就来总结一下. 0. GitHub - 开发者最最最重要的网站:https://github.com 这个不用多说了吧,代码托管网站,上面有很多资源, ...
- 编程精粹 --Microsoft编写优质无错C程序秘诀
献给我的妻子Beth, 以及我的双亲Joseph和Julia Maguire ────为了他们的爱和支持 序 1986年,在为几家小公司咨询和工作了10年之后为了获得编写Macintosh应用程序的经 ...
- 前后端实现Base64格式的传参及转换
js开发过程中,有可能遇到参数传输出现乱码等问题,那么怎么解决这类问题呢?那就是对参数进行Base64编码,在传输完成后,在通过解码获取原参数值.为了实现这个功能,我们需要用到Base64.js,其源 ...
- 覆盖10亿设备,月活2亿,快应用要取代App?
作者 | 伍杏玲 来源 | CSDN(ID:CSDNnews) 2017 年 1 月 9 日,微信小程序横空出世,紧接着支付宝小程序.百度智能小程序.今日头条小程序.12 大厂商联盟的快应用等布局小程 ...
- javascript中的Base64.UTF8编码与解码详解
javascript中的Base64.UTF8编码与解码详解 本文给大家介绍的是javascript中的Base64.UTF8编码与解码的函数源码分享以及使用范例,十分实用,推荐给小伙伴们,希望大家能 ...
最新文章
- Pandas:透视表(pivotTab)和交叉表(crossTab)
- Infineon第九届汽车电子开发者大会宣传视频
- Python 操作Word文档插入图片和表格实例演示
- vnc远程桌面复制文件Linux,vncviewer远程桌面linux
- python异常值处理实例_利用Python进行异常值分析实例代码
- 用python设计学生管理系统_基于python和tkinter实现的一个简单的学生信息管理系统...
- 前端websocket获取数据后需要存本地吗_是什么让我放弃了Restful API?了解清楚后我全面拥抱GraphQL!...
- 活动目录管理之批量创建域用户
- 企业常用OSPF组网配置示例
- linux搭建windows无盘系统,Ubuntu系统搭建drbl无盘服务端环境
- JanusGraph图数据库系统简介
- api质量等级_API质量等级与机油选用指引
- 头号玩家VR跑步机KAT Walk Mini上市,支持各种主流VR头显
- 修改本机的 Host 文件
- 计算圆、圆球和圆锥的面积和体积
- nodejs中的__filename和__dirname的使用说明
- 国产手风琴的前生今世
- 火狐浏览器--由于不能验证所收到的数据是否可信
- 数据分析 | 数据可视化图表,BI工具构建逻辑
- 计算机考试试卷怎么做,雨课堂怎么新建试卷 雨课堂制作试题的方法
热门文章
- 【毕业季·进击的技术er】一个读研学生的唠唠嗑
- 【集合论】序关系 : 总结 ( 偏序关系 | 偏序集 | 可比 | 严格小于 | 覆盖 | 哈斯图 | 全序关系 | 拟序关系 | 偏序关系八种特殊元素 | 链 | 反链 ) ★★
- Unity 之 ShaderGraph 实现旋涡(传送门)效果入门级教程
- Qt网络资源汇总(官网、源码、社区、博客)
- L1-038 新世界 (5 分)C语言
- 说说dota、人生、程序(长篇、神经质)
- mysql 幕客网_Mysql(一)
- 呼叫中心运营管理的七点建议
- [绝对原创] AKM项目轶事之FLYBACK飞机晚点索赔
- DataPipeline亮相“2021科技助力湾区数字金融发展峰会”,解锁“实时数据管理”密码