当前位置:网站首页>5.The Simple Problem
5.The Simple Problem
2022-04-23 06:08:00 【linsa_ pursuer】
Title Description
Solo Went to University , Interested in Mathematics , One day he faced three points , One Sequence( The sequence ) In front of him , It baffled him ……
The sequence is as follows :S(a,k,n)=a+(k+a)+(2k+a)+…+(nk+a), The title asks him to sum the sequences , however a、k、n There are many values , He doesn't know what to do , So he decided to write a program ……
Can you get it?
Topic data range :
0<=a<=100.
0<=k<=100.
0<=n<=100.
Answer request time limit :1000ms, Memory limit :64MB
Input
There is only one line of input , Contains three integers a、k and n.
Output
According to the input a、k and n, Output S(a,k,n) Value .
Examples
sample input 1 Copy
1 2 4
sample output 1
25
Tips
In the example a=1,k=2,n=4, be S(a,k,n)=1+3+5+7+9=25.
package com;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner s = new Scanner(System.in);
System.out.println(sum(s.nextInt(),s.nextInt(),s.nextInt()));
}
public static int sum(int a,int k,int n){
int sum = 0;
for(int i=0;i<=n;i++){
sum += i*k + a;
}
return sum;
}
}
版权声明
本文为[linsa_ pursuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220533259848.html
边栏推荐
- Anaconda
- Latex快速入门
- 线性代数第三章-矩阵的初等变换与线性方程组
- Pytorch introduction notes - use a simple example to observe the output size of each layer of forward propagation
- 解决报错:ImportError: IProgress not found. Please update jupyter and ipywidgets
- 线代第四章-向量组的线性相关
- Protected (members modified by protected are visible to this package and its subclasses)
- Viewer: introduce MySQL date function
- 深入理解去噪论文——FFDNet和CBDNet中noise level与噪声方差之间的关系探索
- Pytorch learning record (7): skills in processing data and training models
猜你喜欢
Pytoch -- data loading and processing
LDCT图像重建论文——Eformer: Edge Enhancement based Transformer for Medical Image Denoising
Pytorch learning record (V): back propagation + gradient based optimizer (SGD, adagrad, rmsporp, Adam)
Reading of denoising papers - [cvpr2022] blind2blind: self supervised image denoising with visible blind spots
Practical operation - Nacos installation and configuration
无监督去噪——[TMI2022]ISCL: Interdependent Self-Cooperative Learning for Unpaired Image Denoising
On traversal of binary tree
PyQt5学习(一):布局管理+信号和槽关联+菜单栏与工具栏+打包资源包
Paper on Image Restoration - [red net, nips16] image restoration using very deep revolutionary encoder decoder networks wi
Anaconda installed pyqt5 and pyqt5 tools without designer Exe problem solving
随机推荐
Pytoch -- data loading and processing
Linear algebra Chapter 1 - determinant
Preparedstatement prevents SQL injection
Conda 虚拟环境管理(创建、删除、克隆、重命名、导出和导入)
Algèbre linéaire chapitre 2 - matrice et son fonctionnement
JDBC operation transaction
Pytorch學習記錄(十三):循環神經網絡((Recurrent Neural Network)
CONDA virtual environment management (create, delete, clone, rename, export and import)
Chapter 3 of linear algebra - Elementary Transformation of matrix and system of linear equations
Fundamentals of digital image processing (Gonzalez) I
图像恢复论文——[RED-Net, NIPS16]Image Restoration Using Very Deep Convolutional Encoder-Decoder Networks wi
线性代数第一章-行列式
Numpy common function table sorting of data processing
You cannot access this shared folder because your organization's security policy prevents unauthenticated guests from accessing it
The official website of UMI yarn create @ umijs / UMI app reports an error: the syntax of file name, directory name or volume label is incorrect
深度学习基础——简单了解meta learning(来自李宏毅课程笔记)
给yarn配置国内镜像加速器
Pytorch学习记录(十一):数据增强、torchvision.transforms各函数讲解
Ptorch learning record (XIII): recurrent neural network
線性代數第一章-行列式