当前位置:网站首页>Codeforces Round #802 (Div. 2) 纯补题
Codeforces Round #802 (Div. 2) 纯补题
2022-07-02 18:27:00 【乔大先生】
Educational Codeforces Round 130 Rated for Div. 2
Codeforces Round #802 Div. 2
这次没打比赛,纯补题
A Optimal Path
简单题,甚至可以用循环,但我怕爆时间,简单推个公式
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e4 + 10;
int n, m;
int T;
signed main()
{
cin>>T;
while(T -- ){
cin >> n >> m;
int op = 0;
if(m % 2) op += (m + 1) / 2 + m / 2 * (m + 1);
else op += (m + 1) * m / 2;
op -= m;
for(int i = 1; i <= n; i ++ ){
op += i * m;
}
cout<<op<<endl;
}
return 0;
}
边栏推荐
- Gstore weekly gstore source code analysis (4): black and white list configuration analysis of security mechanism
- Mobile robot path planning: artificial potential field method [easy to understand]
- Windows2008R2 安装 PHP7.4.30 必须 LocalSystem 启动应用程序池 不然500错误 FastCGI 进程意外退出
- 以太网PHY层芯片LAN8720A简介
- Page title component
- 第七章-类基础
- 股票证券公司排名,有安全保障吗
- Juypter notebook modify the default open folder and default browser
- 教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5
- 4274. Suffix expression - binary expression tree
猜你喜欢

教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 網絡安全專家 NSE 5

PHP parser badminton reservation applet development requires online system

安装单机redis详细教程
冒泡排序数组

Tutorial (5.0) 09 Restful API * fortiedr * Fortinet network security expert NSE 5

Codeworks 5 questions per day (1700 average) - day 4

High frequency interview questions

codeforces每日5题(均1700)-第四天

潇洒郎:彻底解决Markdown图片问题——无需上传图片——无需网络——转发给他人图片无缺失

全志A33使用主线U-Boot
随机推荐
[test development] takes you to know what software testing is
PHP asymmetric encryption method private key and public key encryption and decryption method
MySQL advanced (Advanced) SQL statement
Getting started with typescript
Chic Lang: completely solve the problem of markdown pictures - no need to upload pictures - no need to network - there is no lack of pictures forwarded to others
Golang concurrent programming goroutine, channel, sync
《架构整洁之道》读书笔记(下)
2022 software engineering final exam recall Edition
Learn the knowledge points of eight part essay ~ ~ 1
NPOI导出Excel2007
Yunna | why use the fixed asset management system and how to enable it
Memory management of C
Preprocessing and preprocessing macros
思维意识转变是施工企业数字化转型成败的关键
Juypter notebook modify the default open folder and default browser
A4988驱动步进电机「建议收藏」
MySQL表历史数据清理总结
Qpropertyanimation use and toast case list in QT
Page title component
Bubble sort array