Description

The kids in my son's kindergarten made Christmas cookies with their teacher, and piled them up in columns.  They then arranged the columns so that the tops of the columns, going from shortest to tallest, were in a nice straight ramp.  The cookies were all of uniform size.  Given that there were A cookies in the shortest pile, that the difference in height between any two adjacent piles was D cookies, and that there were N piles, can you write a program to figure out how many cookies there were in total?
 
INPUT
The first line
contains the number of test cases T. T lines follow, one corresponding
to each test case, containing 3 integers : N, A and D.
 
OUTPUT
Output T lines, each line containing the required answer for the corresponding test case.
 
CONSTRAINTS
T <= 100
1 <= N, A, D <=100
 
SAMPLE INPUT
3
1 1 1
3 5 6
2 1 2
 
SAMPLE OUTPUT
1
33
4
 
EXPLANATION
In the second test case the sequence is: 5, 11, 17 whose sum is 33.

题意: n   a   d   大概就是n个盘子  默认从小到大排序   最小的里面放了a个东西   从最小到最大一次增加d个物品     求全部盘子里的全部物品

5+(5+6)+((5+6)+6)   ==   33

 #include <iostream>
#include <string.h>
#include <stdio.h> using namespace std; int main()
{
int n,a,d;
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d",&n,&a,&d);
int sum=;
sum+=(a*n);
for(int i=;i<n;i++)
{
sum+=d*i;
}
printf("%d\n",sum);
}
return ;
}

F - Cookies Piles的更多相关文章

  1. Codeforces Round #530 (Div. 2) F - Cookies

    F - Cookies 思路:我们先考虑如何算出在每个节点结束最多能吃多少饼干, 这个dfs的时候用线段树维护一下就好了, 然后有个这个信息之后树上小dp一下就好啦. #include<bits ...

  2. Codeforces Round #530 (Div. 2)F Cookies (树形dp+线段树)

    题:https://codeforces.com/contest/1099/problem/F 题意:给定一个树,每个节点有俩个信息x和t,分别表示这个节点上的饼干个数和先手吃掉这个节点上一个饼干的的 ...

  3. Codeforces Round #530 (Div. 2) F (树形dp+线段树)

    F. Cookies 链接:http://codeforces.com/contest/1099/problem/F 题意: 给你一棵树,树上有n个节点,每个节点上有ai块饼干,在这个节点上的每块饼干 ...

  4. Codeforces 1099 - A/B/C/D/E/F - (Done)

    链接:https://codeforces.com/contest/1099 A - Snowball - [模拟水题] 题意:有一个雪球从山顶滚落,山坡上有两块石头,每秒钟会一次发生三件事:1.雪球 ...

  5. 用selenium获取cookies

    前言:由于登录反爬措施的越来越麻烦,甚至出现了12306这种看图识物的无敌验证码,我只能说,我选择死亡.这就衍生出了使用selenium来获取获取cookies. 实例:获取qq空间cookies,亲 ...

  6. day95_11_28,selenium定位元素,cookies获取

    一.selenium selenium可以将一些资源定位: # 1.find_element_by_id 根据id找 # 2.find_element_by_link_text 根据链接名字找到控件( ...

  7. 就是这么简单!使用Rest-assured 测试Restful Web Services

    使用 Rest-assured 测试 Restful Web Services 转载注明出处: http://www.cnblogs.com/wade-xu/p/4298819.html 这里向大家介 ...

  8. [Google Code Jam (Qualification Round 2014) ] B. Cookie Clicker Alpha

    Problem B. Cookie Clicker Alpha   Introduction Cookie Clicker is a Javascript game by Orteil, where ...

  9. PHPCMS v9.6.0 wap模块 SQL注入

    调试这个漏洞的时候踩了个坑,影响的版本是php5.4以后. 由于漏洞是由parse_str()函数引起的,但是这个函数在gpc开启的时候(也就是php5.4以下)会对单引号进行过滤\'  . 看这里: ...

随机推荐

  1. start()方法和run()方法有什么区别?

    通过调用线程类的start()方法来启动一个线程,使线程处于就绪状态,即可以被JVM来调度执行,在调度过程中,JVM通过调用线程类的run()方法来完成实际的业务逻辑,当run()方法结束后,此线程就 ...

  2. 如何实现HashMap的同步

    HashMap可以通过Map m = Collections.synchronizedMap(new HashMap())来达到同步的效果.具体而言,该方法会返回一个同步的Map,该Map封装了底层的 ...

  3. Valid Mountain Array LT941

    Given an array A of integers, return true if and only if it is a valid mountain array. Recall that A ...

  4. 【UI测试】--菜单位置

  5. IOS初级:app的图标

    1,首先准备6张png图,分辨率一定要正确,不然报错(The app icon set named "AppIcon" did not have any applicable co ...

  6. nginx xxx.conf

    server { listen 80 ; server_name xxx.test.cn localhost 127.0.0.1 115.29.96.222; access_log /var/log/ ...

  7. Scrapy的安装和基本使用方法

    Scrapy的安装 1. Windows下安装流程: 方法一: 命令行执行pip install scrapy 安装scrapy 注意:如果有anaconda,也可以打开“Anaconda promp ...

  8. 导入CA证书报错 keytool error: java.lang.Exception: Input not an X.509 certificate

    导入CA证书报错: keytool error: java.lang.Exception: Input not an X.509 certificate 如果你的CA证书是如下格式的: -----BE ...

  9. 在 Linux/windows下 命令行中使用和执行 PHP 代码[交互式php]

    [注释]在ubuntu下,升级php到7.1版本,虽然提示的是Interactive mode enabled, 但实际上可以直接书写命令,和interactive shell效果一样. 一:wind ...

  10. js 上传文件夹

    最近公司做工程项目,实现文件夹上传. 网上找了一天,发现网上很多代码都存在相似问题,最后终于找到了一个符合要求的项目. 工程如下: 这里对项目的文件传输功能做出分析,怎么实现文件夹上传的,如何进行文件 ...