题目传送门

 /*
水题:ans = (1+2+3+...+n) * k - n,开long long
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std; typedef long long ll; int main(void) //Codeforces Round #304 (Div. 2) A. Soldier and Bananas
{
int k, n, w;
while (scanf ("%d%d%d", &k, &n, &w) == )
{
ll sum = ( + w) * w / * k;
if (sum < n) puts ("");
else printf ("%I64d\n", sum - n);
} return ;
} /*
3 17 4
*/

水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas的更多相关文章

  1. codeforces水题100道 第五题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas (math)

    题目链接:http://www.codeforces.com/problemset/problem/546/A题意:一个人现在有n元,它买第i根香蕉需要i*k元,问他要买w根香蕉的话,需要问他的朋友借 ...

  2. 数学+DP Codeforces Round #304 (Div. 2) D. Soldier and Number Game

    题目传送门 /* 题意:这题就是求b+1到a的因子个数和. 数学+DP:a[i]保存i的最小因子,dp[i] = dp[i/a[i]] +1;再来一个前缀和 */ /***************** ...

  3. DP+埃氏筛法 Codeforces Round #304 (Div. 2) D. Soldier and Number Game

    题目传送门 /* 题意:b+1,b+2,...,a 所有数的素数个数和 DP+埃氏筛法:dp[i] 记录i的素数个数和,若i是素数,则为1:否则它可以从一个数乘以素数递推过来 最后改为i之前所有素数个 ...

  4. queue+模拟 Codeforces Round #304 (Div. 2) C. Soldier and Cards

    题目传送门 /* 题意:两堆牌,每次拿出上面的牌做比较,大的一方收走两张牌,直到一方没有牌 queue容器:模拟上述过程,当次数达到最大值时判断为-1 */ #include <cstdio&g ...

  5. 贪心 Codeforces Round #304 (Div. 2) B. Soldier and Badges

    题目传送门 /* 题意:问最少增加多少值使变成递增序列 贪心:排序后,每一个值改为前一个值+1,有可能a[i-1] = a[i] + 1,所以要 >= */ #include <cstdi ...

  6. 水题 Codeforces Round #302 (Div. 2) A Set of Strings

    题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...

  7. 水题 Codeforces Round #299 (Div. 2) A. Tavas and Nafas

    题目传送门 /* 很简单的水题,晚上累了,刷刷水题开心一下:) */ #include <bits/stdc++.h> using namespace std; ][] = {" ...

  8. 水题 Codeforces Round #303 (Div. 2) A. Toy Cars

    题目传送门 /* 题意:5种情况对应对应第i或j辆车翻了没 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 3: if both cars turned over during th ...

  9. 水题 Codeforces Round #286 (Div. 2) A Mr. Kitayuta's Gift

    题目传送门 /* 水题:vector容器实现插入操作,暴力进行判断是否为回文串 */ #include <cstdio> #include <iostream> #includ ...

随机推荐

  1. testng 工程报错java.net.SocketException

    报错如下: java.net.SocketException: Software caused connection abort: socket write error at java.net.Soc ...

  2. OpenGL之路(五)制作旋转飞机模型

    #include <gl/glut.h> #include <gl/GLU.h> #include <gl/GL.h> #pragma comment(lib, & ...

  3. Vs2012在Linux开发中的应用(6):改写Makefile项目的Build过程

    MSBUILD的编译过程实际上是依据一系列的targets文件定义的.当我们在IDE运行生成.批生成.清理命令的时候.VS会查找这些命令相应的Task并运行它,以下我们逐个分析这个过程. 当运行生成操 ...

  4. 设计模式学习笔记——State状态模式

    从一个类中,将有关状态的处理分离出来,独立成类,并面向接口编程.作用是可以简化代码,避免过多的条件判断:if-else-

  5. VUE 之 组件

    组件是为了解决页面布局的. 什么是单页面? 答:整个页面的切换都是在这个页面上进行变化的,没有页面的刷新. 1.全局组件 1.1全局组件流程:    1.创建全局组件======>创建一个Vue ...

  6. Codeforces Round #422 (Div. 2) A. I'm bored with life 暴力

    A. I'm bored with life     Holidays have finished. Thanks to the help of the hacker Leha, Noora mana ...

  7. Android开发之开机自动启动应用

    package com.raycloud.wolf.autostart; import android.content.BroadcastReceiver; import android.conten ...

  8. C语言操作SQLite数据库

    SQLite头文件和源文件下载地址http://www.sqlite.org/download.html 以下是示例代码 #include <stdio.h> #include " ...

  9. XMU C语言程序设计实践(5)

    •       使用动态链表完成一个简单的商品库存信息管理系统. •       商品信息包括如下字段:商品号.商品名称.商品库存 •       函数 create:接收用户输入的商品号和商品名称的 ...

  10. java性能时间与空间消耗

    Java性能时间与空间消耗 一.减少时间消耗 标准代码优化 (1) 将循环不变量的计算移出循环 例如:for (int i=0; i<size()*2; i++) { ... } ------& ...