当前位置:网站首页>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;
}
边栏推荐
- [paper reading] Ca net: leveraging contextual features for lung cancer prediction
- 安装单机redis详细教程
- 《重构:改善既有代码的设计》读书笔记(上)
- C的内存管理
- Excel finds the same value in a column, deletes the row or replaces it with a blank value
- 股票证券公司排名,有安全保障吗
- 2022.7.1-----leetcode. two hundred and forty-one
- 2022 software engineering final exam recall Edition
- IDEA编辑器去掉sql语句背景颜色SQL语句警告No data sources are configured to run this SQL...和SQL Dialect is Not Config
- Memory management of C
猜你喜欢

Machine learning notes - time series prediction research: monthly sales of French champagne

云呐|为什么要用固定资产管理系统,怎么启用固定资产管理系统

IEDA refactor的用法

zabbix5客户端安装和配置

数据降维——因子分析

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

Yolov3 trains its own data set to generate train txt

【测试开发】软件测试—概念篇

450-深信服面经1

Watchful pioneer world outlook Architecture - (how does a good game come from)
随机推荐
4274. Suffix expression - binary expression tree
Data dimensionality reduction principal component analysis
Introduction of Ethernet PHY layer chip lan8720a
2022.7.1-----leetcode.241
ORA-01455: converting column overflows integer datatype
教程篇(5.0) 10. 故障排除 * FortiEDR * Fortinet 网络安全专家 NSE 5
Gamefi链游系统开发(NFT链游开发功能)丨NFT链游系统开发(Gamefi链游开发源码)
Yunna | why use the fixed asset management system and how to enable it
MySQL高级(进阶)SQL语句
A4988驱动步进电机「建议收藏」
In pytorch function__ call__ And forward functions
How to print mybats log plug-in using XML file
A4988 drive stepper motor "recommended collection"
[pytorch learning notes] tensor
C的内存管理
451-memcpy、memmove、memset的实现
注解开发方式下AutowiredAnnotationBeanPostProcessor的注册时机
数据降维——因子分析
[test development] takes you to know what software testing is
Introduction to the paper | analysis and criticism of using the pre training language model as a knowledge base