题意:
x个方格可以构成多少种不同阶梯图形,要求每个组成单位都是正方形。

思路:
容易推出sum[i]=sum[i−1]∗2+now∗nowsum[i] = sum[i - 1] * 2 + now * nowsum[i]=sum[i−1]∗2+now∗now,然后算能用多少个就好了。

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <unordered_map>
#include <bitset>using namespace std;typedef long long ll;
const int maxn = 2e5 + 7;
const int mod = 998244353;ll sum[105];void init() {sum[1] = 1;ll now = 2;for(int i = 2;i <= 30;i++) {sum[i] = sum[i - 1] * 2 + now * now;now *= 2;}
}int main() {init();int T;scanf("%d",&T);while(T--) {ll x;scanf("%lld",&x);int ans = 0;for(int i = 1;i <= 30;i++) {if(x >= sum[i]) {ans = i;x -= sum[i];} else {break;}}printf("%d\n",ans);}return 0;
}

Codeforces 1419B. Stairs相关推荐

  1. Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题

    A. Dasha and Stairs 题目连接: http://codeforces.com/contest/761/problem/A Description On her way to prog ...

  2. 【Codeforces】925A Stairs and Elevators【贪心】

    [Codeforces]925A Stairs and Elevators [题目大意] 在一个n*m的矩阵里,有clcl个楼梯和cece个电梯,电梯和楼梯可以到任意一层,给出clcl个楼梯的位置和c ...

  3. 【Codeforces】967C Stairs and Elevators (二分)。

    http://codeforces.com/contest/967/problem/C 从一个地方到另一个地方,可以选择爬楼梯或者坐电梯 ,前提是楼梯或者电梯存在. n 楼层数 m 每一层的房间数 s ...

  4. By Elevator or Stairs? CodeForces - 1249E(动态规划)

    题意 n层楼,a[i] (0<i<n)表示从 i 楼到 i + 1 楼走楼梯的时间,b[i] (0<i<n)表示从 i 楼到 i + 1 楼乘电梯的时间,其中每一次乘电梯需要等 ...

  5. Codeforces Round #272 (Div. 2)

    链接 : http://codeforces.com/contest/476 D题yy,ABC水 A. Dreamoon and Stairs time limit per test 1 second ...

  6. codeforces round div2,3周赛补题计划(从开学到期末)

    1. 本学期场次 从2020.09.19-2021.01.18,一共18周. 题号 场次 日期 备注 1475 Codeforces Round #697 (Div. 3) 1.25 1474 Cod ...

  7. CODEFORCES 272C Dima and Staircase 细节理解题+简单技巧

    传送门:http://codeforces.com/problemset/problem/272/C C. Dima and Staircase time limit per test 2 secon ...

  8. E. By Elevator or Stairs?

    链接:https://codeforces.com/contest/1249/problem/E You are planning to buy an apartment in a nn-floor ...

  9. CodeForces 375D Tree and Queries

    传送门:https://codeforces.com/problemset/problem/375/D 题意: 给你一颗有根树,树上每个节点都有其对应的颜色,有m次询问,每次问你以点v为父节点的子树内 ...

  10. 「日常训练」Bad Luck Island(Codeforces Round 301 Div.2 D)

    题意与分析(CodeForces 540D) 是一道概率dp题. 不过我没把它当dp做... 我就是凭着概率的直觉写的,还好这题不算难. 这题的重点在于考虑概率:他们喜相逢的概率是多少?考虑超几何分布 ...

最新文章

  1. 生物信息学就是从统计和CS的community里借鉴合适的方法
  2. 如何用asp.net实现校验功能!
  3. 独立思考者模型:寻找潜藏在表象背后的真相 探寻真相的方法
  4. 设计模式学习笔记-观察者模式
  5. 整理一些完全免费开放的API接口
  6. 1使用技巧_新版PubMed使用技巧1
  7. python zipfile setpassword_Python模块:zipfile
  8. 【李宏毅机器学习】Recurrent Neural Network Part2 循环神经网络(p21) 学习笔记
  9. 豆瓣再被约谈处罚150万!一年被罚20次,豆瓣到底怎么了?
  10. 代理网络中安装tomcat的注意事项
  11. CISSP考试复习经历分享2020年12月
  12. 苹果App Store搜索出Bug,网友:完美避开所有正确答案
  13. jQuery中关于jQuery.fn.init.prototype = jQuery.fn的解读
  14. vuejs搭建的项目对于ie浏览器的处理
  15. 基于Ip的刷投票排名及刷百度推广的自动化实现
  16. 转载:MHL原理剖析
  17. SQL中is not null和!=“ “的区别
  18. 将汉子转化为拼音的js插件
  19. 解读|TARS开源项目发布Go语言版本
  20. 6824入门坑 go build 错误

热门文章

  1. 将计算机设置成交换机主机名,交换机配置基本使用命令解析
  2. javascript根据浏览器userAgent判断浏览器类型
  3. CMMI3-CMMI5评估认证需要遵循七大原则
  4. jcp jsr_Oracle提交了第三次JCP改革JSR,以提高透明度
  5. 浅谈对工厂方法模式的理解
  6. 数据分析——R语言基础操作(1)-数据表示和矩阵基本操作
  7. 使用格拉姆角场(GAF)以将时间序列数据转换为图像
  8. Python学习 之 tenacity重试模块
  9. 指纹采集器测试软件,售完存档:小熊做的关于奔凯BIOCOME USB指纹采集器 指纹识别仪TCR4 Win7 Win8 Win10下的使用教程...
  10. 历尽磨难,探索未来生活的2014年