当前位置:网站首页>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;
}
边栏推荐
- 程序猿入门攻略(十二)——数据的存储
- 2022.7.1-----leetcode. two hundred and forty-one
- metric_logger小解
- 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
- 为什么要做企业固定资产管理系统,企业如何加强固定资产管理
- Why should we build an enterprise fixed asset management system and how can enterprises strengthen fixed asset management
- 【测试开发】一文带你了解什么是软件测试
- 冒泡排序数组
- Use cheat engine to modify money, life and stars in Kingdom rush
- Tutoriel (5.0) 10. Dépannage * fortiedr * fortinet Network Security expert NSE 5
猜你喜欢

PHP parser badminton reservation applet development requires online system

Refactoring: improving the design of existing code (Part 1)

zabbix5客户端安装和配置

Introduction to the paper | analysis and criticism of using the pre training language model as a knowledge base

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

PHP-Parser羽毛球预约小程序开发require线上系统

论文导读 | 机器学习在数据库基数估计中的应用

Yolov3 trains its own data set to generate train txt

Advanced performance test series "24. Execute SQL script through JDBC"

Novice must see, click two buttons to switch to different content
随机推荐
Digital scroll strip animation
Obligatoire pour les débutants, cliquez sur deux boutons pour passer à un contenu différent
What is 9D movie like? (+ common sense of dimension space)
Emmet基础语法
MySQL高级(进阶)SQL语句
Reading notes of code neatness
metric_logger小解
电脑使用哪个录制视频软件比较好
451-memcpy、memmove、memset的实现
Compile oglpg-9th-edition source code with clion
虚拟机初始化脚本, 虚拟机相互免秘钥
使用xml文件打印mybaties-log插件的方式
开发固定资产管理系统,开发固定资产管理系统用什么语音
数据降维——主成分分析
Processing strategy of message queue message loss and repeated message sending
第七章-类基础
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
Tutorial (5.0) 09 Restful API * fortiedr * Fortinet network security expert NSE 5
[pytorch learning notes] tensor
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径