#include <bits\stdc++.h>
using namespace std;
#define LL long long
const LL MAXN=1000000000;
LL a[30]={1};
LL b[30]={1};
int main()
{
for(int i=1;i<=30;i++)
a[i]=2*a[i-1];
for(int i=1;i<30;i++)
b[i]=a[i]+b[i-1];
int t;
LL n,ans;
scanf("%d",&t);
while(t--)
{
scanf("%I64d",&n);
ans=n*(n+1)/2;
int i=0;
while(n>=a[i])
i++;
i--;
ans-=2*b[i];
printf("%I64d\n",ans);
}
}相关推荐
Android-S无线模块前瞻
WiFi - mainlane非强制 S 采用反射的方法直接加载wifiservice,直接hook在systemserver上,无编译依赖。gms可以动态替换wifi服务。 R 采用直接启动service的方式,wifiservice仍然map在systemserver上。 WiFi - 11ad接口支持 11ad被wifi联盟商业化为WIGIG,提供短距的60GHZ载波,理论速度为当前5G 11ac的6倍。市面上基本没有手机支持,需要独立的芯片支撑此功能。 传输距离为3m以内,外界d.
Coderforce 598A Tricky Sum (数学)
题意:求数字之和,但是要减去2的倍数 思路:直接求... #include #include #include #include #include #include using namespace std; int main () { long long sum,n,t,x; int i; scanf("%lld",&t); while(t--) {
手把手教你用Isaac Sim 8打造逼真光影效果:参数设置与场景应用
本文详细介绍了如何使用Isaac Sim 8打造逼真光影效果,涵盖基础参数设置、高级材质交互、专业级灯光造型技法以及复杂场景的灯光布局策略。通过实战案例和参数调优技巧,帮助用户提升虚拟场景的视觉表现,适用于数字孪生、虚拟仿真和影视特效等领域。
cf 598 A
A. Tricky Sum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem you are to calculate the sum o
Java Web 图书管理系统的制作指南
实现对图书信息的增删改查(CRUD)操作。支持用户登录与权限管理。图书借阅与归还功能。系统管理员可以管理用户信息和图书库存。
MCAL中MCU的配置
MCAL配置中MCU配置,PLL计算配置,系统时钟以及各模块参数配置
CF 598A Tricky Sum【规律】
A. Tricky Sum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem you are to calculate the sum o
与OpenClaw同类性质的AI智能体框架/工具汇总(小白友好)
OpenClaw的核心定位是「开源、本地优先、可执行真实任务的AI代理」,核心价值是让AI从“聊天”落地到“动手干活”(操控电脑/服务器、处理办公/系统任务)。结合这一核心,以下是同类性质的工具/框架,按「小白易上手程度」排序,每个产品重点说明和OpenClaw的异同、核心优势及适配场景,方便小白快速区分选择。
CF598A Tricky Sum
题意: 该题目有多组数据,每组数据给出一个n,让你求出从1到n的和,但是其中每当遇到一个数是2的次幂时,就要变加为减。例如输入n=4,那么计算算式为-1-2+3-4=-4,因为1是2^0,2是2^1,4是2^2。共有t组数据。 其实做法很简单,把从1到n的和用等差数列算出来,然后用log2n计算出不大于n的2的幂次共有多少个,用等比数列求和公式求出它们的和,减去两倍的它即可。 但是我发现...
2023年全国青少年信息素养大赛C++编程初中组决赛真题+答案解析
2023年全国青少年信息素养大赛C++编程初中组决赛真题+答案解析
【RT-DETR涨点改进】全网独家首发、特征融合改进篇 | AAAI 2026 | 引入CDEM交叉动态增强模块,双向引导和融合,在低光图像增强中有效提升了图像的亮度,提升小目标和暗目标的检测准确率
本文提出了一种基于CDEM(交叉动态增强模块)改进的rtdetr网络模型,有效提升了在低光和复杂环境下的目标检测性能。CDEM模块通过动态增强亮度与色彩特征,改善图像输入质量,增强细节和对比度。该模块具有轻量级结构,易于集成到现有模型中,能够显著提升小目标和暗目标的检测准确率与鲁棒性。文章详细介绍了CDEM模块的结构原理、实现方法,并提供了完整的代码实现和配置指南,包括三种改进版本的YAML配置文件。实验结果表明,该方法在图像增强和目标检测任务中均取得了优异性能。
CF598
CF EDU 1 A Tricky Sum 题目链接 思路 首先如果2的次幂是减号的话, 我们可以将2的次幂这个等比数列求出来。 根据等比数列求和公式a1(1−qn)1−q\frac{a1(1 - q^n)}{1-q}1−qa1(1−qn), 将公比2代入, 将a1为1 代入, 可得∑i=0n2i=2n+1−1\sum_{i=0}^{n}2^i = 2^{n+1} - 1∑i=0n2i=2n+1−1。那么, 原题我们就可以将答案减去这个2的次幂和了 再来考虑剩下的: 原题中剩下的都是正的, 为1到n中不
82、yolov11检测模型迁移瑞芯微rk3588和使用昇腾设备300i DUO卡推理 batch=1/3,支持昇腾NMS迁移npu推理
本文介绍了使用昇腾设备进行分割推理的测试流程,包括两种测试方式(cann+onnx和om)。首先验证300iDUO卡的可用性,随后创建Docker镜像和容器以搭建独立环境。通过从指定仓库拉取Ubuntu 20.04镜像,创建容器并映射目录。进入容器后安装必要组件(Python3、GCC等)和系统工具(pciutils、net-tools等),为后续模型转换和迁移做准备。整个流程旨在构建可交付给第三方的标准化测试环境。
【codeforces】-598A-Tricky Sum(数列求和,2的幂为负)
A. Tricky Sum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem you are to calculate the sum o
锂电池充电器电路设计 里面有电路
锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。
计算机控制技术及应用
《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。
CF#320 Div.2 总结
比赛网址:cf#320 Div.2 晚上11点开始的比赛,持续2个半小时。结束时有两道题题过了预测数据,分时是A题和C题。 比赛开始的时候,理所当然地从A题开始看起。A题比较容易,稍微分析一下就可以看出是一道10进制转2进制的题目,虽然题目比较简单,但是由于敲代码不够熟练,并且还要测试一些数据的原因,当我提交时已经有接近2000人A了此题。 然后我开始看B题,B题题意比较容易理解,而且我觉得
lwip-2.0.3
lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。
cf 20a BerOS file system
#include #include using namespace std; int main() { string s; cin>>s; bool flag=false; int p=s.length()-1; while(s[p]=='/') p--; if(p==-1) s="/"; else
假人有限元模型
假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用
cf 88b Keyboard
#include #include #include using namespace std; #define del(a,b) memset(a,b,sizeof(a)) struct node { int x,y; }nn[900]; int aa[130]; bool flag; int n,m,x,q,ans,snum; char kb[33][33]; string s;
cf #327 Div.2 Problem B Rebranding
#include #include #include using namespace std; int n,m; char aa[30]={'a'}; char s[200005]; char *ss[200005]; char a,b; int main() { for(int i=1;i<26;i++) aa[i]=aa[i-1]+1; scanf("%d
cf#320 Div.2 Problem C A Problem about Polyline
#include #include #include using namespace std; double ans,a; int x,y; int main(){ scanf("%d%d",&x,&y); if(y==x){ printf("%.12lf\n",(double)x); } else if(x<y){ print
cf 2a Winner
#include #include #include using namespace std; string ss[1005]; int x[1005]; int main() { int N; string win; int maxn=0; cin>>N; map M; for(int i=0;i<N;i++) { c
cf 8a Train and Peter
#include #include #include using namespace std; int main() { string s,s1,s2; bool f1=false,f2=false; cin>>s>>s1>>s2; int a,b; a=s.find(s1); if(a!=std::string::npos) {
cf#320 Div.2 Problem D "Or" Game
#include #include #include using namespace std; #define LL long long int n,k,x; int a[200005],l[200005],r[200005]; int main(){ scanf("%d%d%d",&n,&k,&x); for(int i=1;i<=n;i++) scanf(
cf#320 Div.2 Problem E Weakness and Poorness
这题的代码是参考比赛中大神的AC代码的,据说用到了三分思想和前缀和,这里先记下来,日后再消化 #include #include #include #include using namespace std; int N; int A[200005]; double f(double x){ double res=0,s1=0,s2=0; for(int i=0;i
cf 15a Cottage Village
#include #include #include using namespace std; struct node { double x,a,l,r; }nn[1005]; int n; double t; bool cmp(const node &n1,const node &n2) { return n1.x<n2.x; } int main() { scan
cf 75c Modified GCD
#include #include using namespace std; int gcd(int a,int b) { int t; if(a<b) { t=a;a=b;b=t; } while(t=a%b) { a=b; b=t; } return b; } int main(
cf 9a Die Roll
#include #include using namespace std; int main() { int a,b; scanf("%d%d",&a,&b); a=max(a,b); if(a==1) printf("1/1\n"); else if(a==2) printf("5/6\n"); else if
1043



被折叠的 条评论
为什么被折叠?



