当前位置:网站首页>Krypton saikr daily question - CTF
Krypton saikr daily question - CTF
2022-07-04 04:24:00 【GHOSTANDBREAD】
Description
After vaguely entering the University , You decided to take part in the competition and stand out , But you in the computer college , But I found that competition is not equal to E-sports , You choose left and right , Found out acm and ctf, You always wanted to be a hacker , Decided to go ctf Study there , But when ctf There are so many things to learn ,pwn,web, reverse ...., As a sprout, you decide to brush more questions .
The senior assigned you a study plan , Considering that the essence of computer is binary , So you will be 2^121 Brush one question every day for one day ,2^222 Brush two questions every day for one day , That is to say 1,21,2 Brush one question every day , The first 33 To 66 Brush two questions every day ,2^x2x Brush every day xx topic , And so on , With the basis of algorithm, you decide to write a program to see how many problems you want to write in the specified number of days
Input
An integer tt Days (1 \leq t \leq 10^7)(1≤t≤107).
Output
An integer xx Indicates the number of topics to brush .
Sample Input 1
9
Sample Output 1
19
The code is as follows :
#include<iostream>
#include<cmath>
using namespace std;
int n, sum = 0;
int main()
{
ios::sync_with_stdio(false);
cout.tie(NULL);
cin >> n;
int i = 1;
while(n - pow(2, i) > 0)
{
sum += i * pow(2, i);
n -= pow(2, i);
i ++;
}
sum += n * i;
cout << sum;
return 0;
}
边栏推荐
- Tcp- simple understanding of three handshakes and four waves
- Flink学习7:应用程序结构
- Configuration and hot update of nocturnal simulator in hbuildx
- 01 qemu 启动编译好的镜像 VFS: Unable to mount root fs on unknown-block(0,0)
- C语言单向链表练习
- leetcode刷题:二叉树08(N叉树的最大深度)
- 虚拟商品帐号交易平台源码_支持个人二维码收款
- Interpretation of leveldb source code skiplist
- [microservices openfeign] two degradation methods of feign | fallback | fallbackfactory
- Confession code collection, who says program apes don't understand romance
猜你喜欢
Evolution of MySQL database architecture
What does software testing do? Find defects and improve the quality of software
Keysight N9320B射频频谱分析仪解决轮胎压力监测方案
Emlog用户注册插件 价值80元
架构训练毕业设计+总结
Brief explanation of depth first search (with basic questions)
The maximum expiration time of client secret in azure ad application registration is modified to 2 years
Tcp- simple understanding of three handshakes and four waves
Understand the principle of bytecode enhancement technology through the jvm-sandbox source code
idea修改主体颜色
随机推荐
The interactive solution of JS and app in the H5 page embedded in app (parameters can be transferred and callbacks can be made)
Keysight N9320B射频频谱分析仪解决轮胎压力监测方案
分布式系统:what、why、how
[Huawei cloud IOT] reading notes, "Internet of things: core technology and security of the Internet of things", Chapter 3 (I)
02 ls 命令的具体实现
【罗技】m720
虚拟商品帐号交易平台源码_支持个人二维码收款
Leetcode brush question: binary tree 06 (symmetric binary tree)
Touch and take you to implement an EventEmitter
[webrtc] M98 Ninja build and compile instructions
What does software testing do? Find defects and improve the quality of software
Redis:集合Set类型数据的操作命令
Huawei cloud Kunpeng engineer training (Guangxi University)
【CSRF-01】跨站请求伪造漏洞基础原理及攻防
R语言中如何查看已安装的R包
(指针)自己写一个比较字符串大小的函数,功能与strcmp类似。
dried food! Generation of rare samples based on GaN
RHCSA 03 - 文件的基础权限
Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
Storage of MySQL database