Utopian Tree in Java

The Utopian tree goes through 2 cycles of growth every year. The first growth cycle occurs during the monsoon, when it doubles in height. The second growth cycle occurs during the summer, when its height increases by 1 meter.

Now, a new Utopian tree sapling is planted at the onset of the monsoon. Its height is 1 meter. Can you find the height of the tree after N growth cycles?

Input Format
The first line contains an integer, T, the number of test cases.

T lines follow. Each line contains an integer, N, that denotes the number of cycles for that test case.

Constraints
1

Original: https://www.cnblogs.com/springfor/p/4005774.html
Author: 爱做饭的小莹子
Title: Utopian Tree in Java

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/539047/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

  • Redis的订阅和发布

    发布与订阅模型,放在每一位开发者身上,都是耳熟能详的一对词语。与设计模式里面的–观察者模式非常相似。在微服务中,把消息中介分离出来成为独立服务,无论是跨服务通信开发和运…

    Java 2023年6月14日
    0114
  • Spring的JDK动态代理如何实现的(源码解析)

    前言 上一篇文章中提到了SpringAOP是如何决断使用哪种动态代理方式的,本文接上文讲解SpringAOP的JDK动态代理是如何实现的。SpringAOP的实现其实也是使用了 P…

    Java 2023年6月7日
    091
  • Java多线程基础:对象内存布局和锁

    Java多线程基础:Synchronized关键字 对象的内存布局 下面的讨论都是 针对HotSpot虚拟机。 首先我们来了解一下对象的内存布局,对象在内存中存储的布局整体 可以分…

    Java 2023年5月29日
    075
  • js session失效退出iframe

    // 代码加入登陆页面中 if( window.top != window.self ){ window.top.location = window.location.href; …

    Java 2023年5月30日
    086
  • RabbitMQ——整合SpringAMQP

    一。什么是Spring-AMQP? 1.Spring框架的AMQP消息解决方案,提供模板化的发送和接收消息的抽象层,提供基于消息驱动的POJO(Plain Ordinary Jav…

    Java 2023年5月30日
    083
  • websocket在线测试工具

    为了测试websocket, 根据网上的一些工具修改了一些, 因此得到了这个工具 源码 源码: websocket在线测试工具 WS WS WSS 发送 连接 清屏 断开 … …

    Java 2023年6月7日
    078
  • SSM-Spring

    day1 Spring IOC 和 AOP 为内核 IOC inverse of control 控制反转AOP aspect oriented programing 面向切面编程…

    Java 2023年6月5日
    076
  • 索引底层实现原理

    要了解数据库索引的底层原理,我们就得先了解一种叫树的数据结构,而树中很经典的一种数据结构就是二叉树!所以下面我们就从二叉树到平衡二叉树,再到B-树,最后到B+树来一步一步了解数据库…

    Java 2023年6月8日
    095
  • 四大函数式接口

    四大函数式接口 Fuction 函数型接口,有一个输入参数,有一个输出参数 函数型接口:输入一个参数,输出输入的参数 //Function 函数型接口 public class D…

    Java 2023年6月5日
    073
  • Spring Security踩坑记录(静态资源放行异常)

    转自:https://blog.csdn.net/qq_34204490/article/details/110005404 Springboot + Spring-Securit…

    Java 2023年5月30日
    082
  • mybatis的一对多(collection)

    使用图解: 低效率查询: 高效率查询: 1 查询用联合查询 2 Original: https://www.cnblogs.com/tangzeqi/p/15111548.html…

    Java 2023年6月6日
    078
  • SpringBoot2.x集成springSecurity和OAuth2.0启动错误处理

    当启用@EnableAuthorizationServer注解时,启动项目报错 报错信息 因为SpringBoot2.x已经将 security.oauth2的自动配置类sprin…

    Java 2023年5月30日
    078
  • 【设计模式】Java版设计模式的类图汇总

    Abstract Factory Intent: Provide an interface for creating families of related or dependen…

    Java 2023年5月29日
    0147
  • MongoDB高级应用之高可用方案实战(4)

    1、MongDB启动与关闭 1.1、命令行启动 ./mongod –fork –dbpath=/opt/mongodb/data —-logpath=/opt/mongod…

    Java 2023年6月7日
    085
  • Dubbo面试大纲

    本篇文章不是进行详细的Dubbo实现以及原理分析的文章,适用于用过Dubbo,对Dubbo有一定了解准备面试的小伙伴阅读。下面列的一些点,如果能在面试时候说到,那面试官肯定觉得不错…

    Java 2023年6月7日
    097
  • 读配置、讲原理、看面试真题,我只能帮你到这了。。。

    当我在写一上来就主从、集群、哨兵,这谁受得了的时候,好多小伙伴就迫不及待的留言想看这些模式了,今天我们就从配置文件、设计原理、面试真题三个方面来聊一聊 Redis 的主从复制。 在…

    Java 2023年6月5日
    069
亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球