博客
关于我
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/

你可能感兴趣的文章
MsEdgeTTS开源项目使用教程
查看>>
msf
查看>>
MSSQL数据库查询优化(一)
查看>>
MSSQL日期格式转换函数(使用CONVERT)
查看>>
MSTP多生成树协议(第二课)
查看>>
MSTP是什么?有哪些专有名词?
查看>>
Mstsc 远程桌面链接 And 网络映射
查看>>
Myeclipse常用快捷键
查看>>
MyEclipse用(JDBC)连接SQL出现的问题~
查看>>
myeclipse的新建severlet不见解决方法
查看>>
MyEclipse设置当前行背景颜色、选中单词前景色、背景色
查看>>
myeclipse配置springmvc教程
查看>>
MyEclipse配置SVN
查看>>
MTCNN 人脸检测
查看>>
MyEcplise中SpringBoot怎样定制启动banner?
查看>>
MyPython
查看>>
MTD技术介绍
查看>>
MySQL
查看>>
MySQL
查看>>
mysql
查看>>