当前位置:网站首页>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;
}
边栏推荐
猜你喜欢
ICDE 2023|TKDE Poster Session(CFP)
搭建主从模式集群redis
Introduction to the paper | application of machine learning in database cardinality estimation
Novice must see, click two buttons to switch to different content
Data dimensionality reduction principal component analysis
Tutorial (5.0) 10 Troubleshooting * fortiedr * Fortinet network security expert NSE 5
新手必看,点击两个按钮切换至不同的内容
Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5
Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management
数据降维——因子分析
随机推荐
453-atoi函数的实现
When converting from list to map, if a certain attribute may cause key duplication and exceptions, you can set the way to deal with this duplication
Gamefi chain game system development (NFT chain game development function) NFT chain game system development (gamefi chain game development source code)
使用xml文件打印mybaties-log插件的方式
二进制操作
Gmapping code analysis [easy to understand]
新手必看,点击两个按钮切换至不同的内容
IEDA refactor的用法
mybatiesHelperPro工具必须的可以生成到对应项目文件夹下
线程应用实例
《架构整洁之道》读书笔记(下)
What is the MySQL backup suffix_ MySQL backup restore
Emmet basic syntax
冒泡排序数组
ICDE 2023|TKDE Poster Session(CFP)
ORA-01455: converting column overflows integer datatype
C file input operation
《重构:改善既有代码的设计》读书笔记(下)
Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management
Tutorial (5.0) 09 Restful API * fortiedr * Fortinet network security expert NSE 5