牛客-金币

https://www.nowcoder.com/acm/contest/170/A

var
    l,r,tot,pre,i:qword;
function max(a,b:int64):int64;
begin
    if a>b then exit(a) else exit(b);
end;
function o(a:int64):int64;
begin
    if a<0 then exit(0) else exit(a);
end;
begin
    readln(l,r);
    tot:=0;i:=1;pre:=0;
    while i*i+pre<=r do
    begin
      tot:=tot+o(pre+i*i-max(l-1,pre))*i;
      pre:=pre+i*i;
      inc(i);
    end;
    tot:=tot+(r-pre)*i;
    writeln(tot);
end.
全部评论

相关推荐

fRank1e:吓得我不敢去外包了,但是目前也只有外包这一个实习,我还要继续去吗
点赞 评论 收藏
分享
风中翠竹:真的真的真的没有kpi。。。面试官是没有任何kpi的,捞是真的想试试看这个行不行,碰碰运气,或者是面试官比较闲现在,没事捞个人看看。kpi算HR那边,但是只有你入职了,kpi才作数,面试是没有的。
双非有机会进大厂吗
点赞 评论 收藏
分享
评论
2
1
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务