Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
43360 姜博睿 【J】T1 C++ 通过 100 956 MS 248 KB 379 2026-10-29 12:59:05

Tests(10/10):


#include <bits/stdc++.h> using namespace std; const int N=1e5+9; long long n,ans,t; void f(long long x){ while(x%2==0)x/=2; t=x; } int main(){ cin>>n; ans+=(3*n+n%2)*(n/2)/2; for(int i=1,j=n+2-n%2;i<=(n+1)/2;i++){ f(j); if(t==0&&i+t/2<=(n+1)/2)ans+=j*j/4,j*=2; else ans+=t,j+=2; } cout<<ans; return 0; }


测评信息: