首页 > 其他分享 >Simple Math Problem

Simple Math Problem

时间:2022-11-07 13:32:59浏览次数:68  
标签:cout Simple ll cin int ans Problem Math 进制


​传送门​

Simple Math Problem_c++

思路:

题目中给出的矩阵均为16进制表示,根据规律输出对应10进制数即可。

#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf = 0x3f3f3f3f;


int main()
{
ll n;
cin>>n;
ll x,y;
cin>>x>>y;
if(x+y < n)
{
cout<<(y+1)*y/2+(y+2+x+1+y)*x/2<<endl;
}
else
{
ll ans = (y+1)*y/2+(y+2+(n-y-1)+1+y)*(n-y-1)/2;
ans += (n+n-(x+y-n+1)+1)*(x+y-n+1)/2;
cout<<ans<<endl;
}
}


标签:cout,Simple,ll,cin,int,ans,Problem,Math,进制
From: https://blog.51cto.com/u_15866543/5829157

相关文章

  • 常用类.SimpleDateFormat
    package常用类.calendar;importjava.text.SimpleDateFormat;importjava.util.Date;publicclasssimpleDateFormat{publicstaticvoidmain(String[]args)throw......
  • CF1685E The Ultimate LIS Problem 题解
    LinkCF1685ETheUltimateLISProblem题意概述给定长为\(2n+1\)的排列,对于\(m\)次交换操作,求出每次操作后一个能使排列\(\text{LIS}\leqn\)的循环移位\(k\),......
  • Math
    Math1.积性函数定义:若函数\(f(n)\)满足\(f(1)=1\)&&\({\forall}{x,y}{\in}{N^{*}},gcd(x,y)=1\)都有\(f(xy)=f(x)*f(y)\)则\(f(n)\)为积性函数​ 若函数\(f(n)\)满......
  • Mathis Petrovich-2021-Action-Conditioned-3D-Human-Motion-Synthesis-with-Transfor
    #Action-Conditioned3DHumanMotionSynthesisWithTransformerVAE#paper1.paper-info1.1MetadataAuthor::[[MathisPetrovich]],[[MichaelJ.Black]],[......
  • [Mathematical Analysis] 函数极限与连续函数(待续……)
    写在前面要当一个创造者。整理这些笔记是为了有所创造。要有所创造,就必须对我所讨论的问题本身有充分的理解,创造的就是在理解和归纳的过程中找到的最符合我个人的最自然......
  • 大文件上传(秒传/断点续传)_使用Vue-Simple-Uploader插件 --Vue/Django完整实现
    Vue-Simple-Uploader插件-Github地址:​​https://github.com/simple-uploader/vue-uploader/blob/master/README_zh-CN.md​​​simple-uploader-详细参数-Github地......
  • 为什么你必须链接C中的MATH库?
    原文链接为什么你必须链接C中的MATH库?如果在C程序中包含<stdlib.h>或<stdio.h>,那么在编译时就不必将它们链接起来,但是我必须使用-lm和gcc链接到<math.h>,例如:gcctest.c......
  • SimpleDateFormat
    SimpleDateFormat /**Copyright(c)1996,2013,Oracleand/oritsaffiliates.Allrightsreserved.*ORACLEPROPRIETARY/CONFIDENTIAL.Useissubjecttol......
  • CF713C Sonya and Problem Wihtout a Legend
    题意给定一个有\(n\)个正整数的数组,一次操作中,可以把任意一个元素加一或减一。(元素可被减至负数或\(0\)),求使得原序列严格递增的求最小操作次数。题解首先有一个常规......
  • [leetcode] The Skyline Problem
      classSolution{publicList<int[]>getSkyline(int[][]buildings){List<int[]>res=newArrayList<>();List<int[]>height=newAr......