我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

怎么来实现一个公式的计算,用C语言来实现的

Problem Description
You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.

Input
In each case, there is an odd positive integer n.

Output
Print the sum. Make sure the sum will not exceed 2^31-1

Sample Input
3

Sample Output
10

为了C币。。。
long 一个 sum = 0;
这个还是for循环
for (int i = 0; i <= n; i += 2)
每次sum += i * i;

最后 printf

近期文章

  • C# wpf 文件地址搜索不到
  • 问一下github创建问题
  • 有用过雅特力at32f407的吗?
  • maya2020的AI标准材质没有预设
  • 用Java编写获取中文首字母
  • PYTHON NOIP 1.4第九题
  • softer-nms
  • 数字的寻找的问题,具体的C语言实现
  • matlab dither函数
  • 有会汽车自主换道系统设计的么?
  • 有限空间求解路径规划问题
  • 怎么用编程画氢原子的电子轨道
  • 是否可以打开盒子的一个判断,怎么采用的C语言,谢谢
  • 使用的element组件,前端显示 ReferenceError: tableData is not defined 如何解决?
  • 默认为平方是什么意思
  • 为什么spring boot aop切面不能切入
  • 为什么最后一行不能写S1.Sname=‘刘晨’
  • 在eclipse的文件夹里找不到org.eclipse.ui.themes这个文件怎么办
  • cst 画出的vivaldi 天线 如何降低两个谐振频率之间的s11参数😢😢
  • matlab dither函数问题

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华