博客
关于我
AtCoder Beginner Contest 190 D - Staircase Sequences
阅读量:151 次
发布时间:2019-02-27

本文共 1117 字,大约阅读时间需要 3 分钟。

D - Staircase Sequences

https://atcoder.jp/contests/abc190/tasks/abc190_d

分解因数,枚举

#include
using namespace std;typedef long long LL;set
> st;//(r + l)*(r - l + 1) = 2 * N;// x * y = 2 * N;//分解因子int main() { LL N; scanf("%lld", &N); N *= 2; LL res = 0; pair
t; for(LL i = 1; i * i <= N; i++) { //别忘了i也要LL; if(N % i == 0) { LL x = i, y = N / i; if((x + y - 1) % 2 == 0) { LL r = (x + y - 1) / 2; LL l = (x - r); t.first = l, t.second = r; if(l <= r && st.find(t) == st.end()) { //printf("ok: %d %d\n", l, r); res ++; st.emplace(t); } swap(x, y); l = (x - r); t.first = l; if(l <= r && st.find(t) == st.end()) { //printf("ok: %d %d\n", l, r); res ++; st.emplace(t); } } } } printf("%lld\n", res); return 0;}

转载地址:http://jfcb.baihongyu.com/

你可能感兴趣的文章
memcached高速缓存学习笔记001---memcached介绍和安装以及基本使用
查看>>
memcached高速缓存学习笔记003---利用JAVA程序操作memcached crud操作
查看>>
Memcached:Node.js 高性能缓存解决方案
查看>>
memcache、redis原理对比
查看>>
memset初始化高维数组为-1/0
查看>>
Metasploit CGI网关接口渗透测试实战
查看>>
Metasploit Web服务器渗透测试实战
查看>>
Moment.js常见用法总结
查看>>
MongoDB出现Error parsing command line: unrecognised option ‘--fork‘ 的解决方法
查看>>
MongoDB学习笔记(8)--索引及优化索引
查看>>
ms sql server 2008 sp2更新异常
查看>>
MS UC 2013-0-Prepare Tool
查看>>
msbuild发布web应用程序
查看>>
MSCRM调用外部JS文件
查看>>
MSEdgeDriver (Chromium) 不适用于版本 >= 79.0.313 (Canary)
查看>>
msf
查看>>
MSSQL数据库查询优化(一)
查看>>
MSSQL日期格式转换函数(使用CONVERT)
查看>>
MSTP多生成树协议(第二课)
查看>>
MSTP是什么?有哪些专有名词?
查看>>