随笔 - 216,  文章 - 0,  评论 - 17,  阅读 - 25533

nl=nl+1=...=nr
nlnr<nl+1
根据不等式左侧,得到 rnnl

例题:https://www.luogu.com.cn/problem/UVA11526

#include<bits/stdc++.h>
using namespace std;
using LL = long long;
void solve(){
	LL n;
	cin >> n;
	LL ans = 0;
	for (LL i = 1, j; i <= n; i = j + 1){
		j = n / (n / i);
		ans += (LL)(j - i + 1) * (n / i);
	}
	cout << ans << "\n";
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	int T;
	cin >> T;
	while (T -- ){
		solve();
	}
	return 0;
}
posted on   Hamine  阅读(68)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
历史上的今天:
2022-02-27 主席树(可持久化权值线段树)
2022-02-27 线段树
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示