题目描述

Solo上了大学,对数学很感兴趣,有一天他面对数分三,一个Sequence(数列)摆在了他面前,这可难住他了……
序列如下:S(a,k,n)=a+(k+a)+(2k+a)+…+(nk+a),题目要他对序列求和,但是a、k、n的取值好多,他不知如何是好,于是他决定写个程序……
Can you get it?

题目数据范围:

  1. 0<=a<=100.
    0<=k<=100.
    0<=n<=100.
解答要求时间限制:1000ms, 内存限制:64MB
输入

输入只有一行,包含三个整数a、k和n。

输出

根据输入的a、k和n,输出S(a,k,n)的值。

样例

输入样例 1 复制

1 2 4

输出样例 1

25
提示

样例中a=1,k=2,n=4,则S(a,k,n)=1+3+5+7+9=25。

// 24 The Simple Problem.cpp : 定义控制台应用程序的入口点。
// #include "stdafx.h" #include "stdlib.h"
int _tmain(int argc, _TCHAR* argv[])
{
int a,k,n,s;
s=;
scanf("%d %d %d",&a,&k,&n);
if((a<)||(a>)||(a<)||(a>)||(a<)||(a>)) {
return ;
} for(int i=;i<=n;i++)
{ s+=(i*k+a); }
printf("%d",s); system("pause");
return ;
}

<每日 1 OJ> -24. The Simple Problem的更多相关文章

  1. POJ 3468 A Simple Problem with Integers (splay tree入门)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 47944   ...

  2. 牛客NC15879 A Simple Problem

    传送门:A Simple Problem 题意 给定两个序列s1和s2,同样的数字可以用相同的别的数字代替(并且也可以是出现过的数字),问s2在s1中出现了几次. 题解 首先预处理一下这两个序列,因为 ...

  3. A - 敌兵布阵 ——B - I Hate It——C - A Simple Problem with Integers(线段树)

    C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况.由于 ...

  4. POJ 3468 A Simple Problem with Integers(线段树 成段增减+区间求和)

    A Simple Problem with Integers [题目链接]A Simple Problem with Integers [题目类型]线段树 成段增减+区间求和 &题解: 线段树 ...

  5. POJ 3468 A Simple Problem with Integers(线段树/区间更新)

    题目链接: 传送门 A Simple Problem with Integers Time Limit: 5000MS     Memory Limit: 131072K Description Yo ...

  6. poj 3468:A Simple Problem with Integers(线段树,区间修改求和)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 58269   ...

  7. ACM: A Simple Problem with Integers 解题报告-线段树

    A Simple Problem with Integers Time Limit:5000MS Memory Limit:131072KB 64bit IO Format:%lld & %l ...

  8. poj3468 A Simple Problem with Integers (线段树区间最大值)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 92127   ...

  9. POJ3648 A Simple Problem with Integers(线段树之成段更新。入门题)

    A Simple Problem with Integers Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 53169 Acc ...

随机推荐

  1. [ROR] 如何在mixin模块中定义类方法(Howto define class methods in a mixin module)

    方法一: 修改模块的include方法 module Bbq def self.included(base) base.send :include, InstanceMethods base.exte ...

  2. HTML不换行,多余用省略号代替

    最主要的css样式: white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 例子: <!DOCTYPE html> ...

  3. js高频经典面试题总结

    类型转换问题 console.log(null>=0); console.log(null<=0); console.log(null==0); console.log(undefined ...

  4. ObjC: 源文件的组织

    转自:http://marshal.easymorse.com/tech/objc-%e6%ba%90%e6%96%87%e4%bb%b6%e7%9a%84%e7%bb%84%e7%bb%87 最简单 ...

  5. android中listview滑动卡顿的原因

    导致Android界面滑动卡顿主要有两个原因: 1.UI线程(main)有耗时操作 2.视图渲染时间过长,导致卡顿 http://www.tuicool.com/articles/fm2IFfU 

  6. Executor的线程代码

    package com.open1111; import java.util.concurrent.ExecutorService;import java.util.concurrent.Execut ...

  7. python绘图 转

    Python有很多可视化工具,本篇只介绍Matplotlib. Matplotlib是一种2D的绘图库,它可以支持硬拷贝和跨系统的交互,它可以在Python脚本.IPython的交互环境下.Web应用 ...

  8. HDU3572 Task Schedule(最大流+构图思维)

    题意: 有N个任务M个机器,给每个任务i完成所花费的时间Pi且每个任务要在第Si天后开始,在第Ei天前结束,保证任务在(S,E)之间一定能完成. 每个机器在一天里只能运行一个任务,一个任务可以在中途更 ...

  9. python爬虫中遇到的问题以及解决方法

    (1)运行后报错:“TypeError: cannot use a string pattern on a bytes-like” 原因:content用decode(‘utf-8’)进行解码,由by ...

  10. CF300D Painting Square

    Painting Square https://codeforces.com/problemset/problem/300/D 给了一个理解起来较复杂但是本质上很简单的分形. 题解 很显然,只有边长为 ...