当前位置:网站首页>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;
}边栏推荐
- (指針)自己寫一個比較字符串大小的函數,功能與strcmp類似。
- 如何远程办公更有效率 | 社区征文
- 北漂程序员,月薪20K,一年攒15W,正常吗?
- *. No main manifest attribute in jar
- The difference between bagging and boosting in machine learning
- [microservices openfeign] two degradation methods of feign | fallback | fallbackfactory
- Redis cluster view the slots of each node
- Flink学习8:数据的一致性
- 【华为云IoT】读书笔记之《万物互联:物联网核心技术与安全》第3章(上)
- 批处理初识
猜你喜欢
随机推荐
How to telecommute more efficiently | community essay solicitation
RHCSA 03 - 文件的基础权限
How to add custom API objects in kubernetes (1)
Flink学习7:应用程序结构
(指针)编写函数void fun(int x,int *pp,int *n)
vim映射命令
【微服务|openfeign】使用openfeign远程调用文件上传接口
Three years of graduation, half a year of distance | community essay solicitation
Redis cluster uses Lua script. Lua script can also be used for different slots
[book club issue 13] packaging format of video files
Leetcode skimming: binary tree 07 (maximum depth of binary tree)
Flink学习6:编程模型
User defined path and file name of Baidu editor in laravel admin
Perf simple process for multithreaded profile
Confession code collection, who says program apes don't understand romance
RHCSA 04 - 进程管理
JS实现文字滚动 跑马灯效果
RHCSA 07 - 用户与群组管理
ROS2中CMake编译选项的设置
Katalon使用script实现查询List大小









