当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
毕业设计:设计秒杀电商系统
虚拟商品帐号交易平台源码_支持个人二维码收款
资深开发人员告诉你,怎样编写出优秀的代码?
tdk-lambda电源主要应用
Global exposure and roller shutter exposure of industrial cameras
Idea configuration 360zip open by default -- external tools
2021 RSC | Drug–target affinity prediction using graph neural network and contact maps
Lnk2038 detected a mismatch of "runtimelibrary": the value "md_dynamicrelease" does not match the value "mdd_dynamicdebug" (in main.obj)
Msgraphmailbag - search only driveitems of file types
User defined path and file name of Baidu editor in laravel admin
随机推荐
02 ls 命令的具体实现
Common methods of threads
01 qemu 启动编译好的镜像 VFS: Unable to mount root fs on unknown-block(0,0)
96% of the collected traffic is prevented by bubble mart of cloud hosting
Configuration and hot update of nocturnal simulator in hbuildx
资深开发人员告诉你,怎样编写出优秀的代码?
[book club issue 13] multimedia processing tool ffmpeg tool set
Leetcode skimming: binary tree 08 (maximum depth of n-ary tree)
Confession code collection, who says program apes don't understand romance
I Build a simple microservice project
idea修改主体颜色
leetcode刷题:二叉树04(二叉树的层序遍历)
Myslq delete followed by limit
Katalon使用script实现查询List大小
Unity draws the trajectory of pinball and billiards
Storage of MySQL database
vim正确加区间注释
Flink学习6:编程模型
One click compilation and deployment of MySQL
Tcp- simple understanding of three handshakes and four waves