zoukankan      html  css  js  c++  java
  • 水题 Codeforces Round #304 (Div. 2) A. Soldier and Bananas

    题目传送门

     1 /*
     2     水题:ans = (1+2+3+...+n) * k - n,开long long
     3 */
     4 #include <cstdio>
     5 #include <algorithm>
     6 #include <cstring>
     7 #include <cmath>
     8 using namespace std;
     9 
    10 typedef long long ll;
    11 
    12 int main(void)        //Codeforces Round #304 (Div. 2) A. Soldier and Bananas
    13 {
    14     int k, n, w;
    15     while (scanf ("%d%d%d", &k, &n, &w) == 3)
    16     {
    17         ll sum = (1 + w) * w / 2 * k;
    18         if (sum < n)    puts ("0");
    19         else    printf ("%I64d
    ", sum - n);
    20     }
    21 
    22     return 0;
    23 }
    24 
    25 
    26 /*
    27 3 17 4
    28 */
    编译人生,运行世界!
  • 相关阅读:
    [HNOI2008] Cards
    loj #136
    a problem
    dp * 3
    STL
    套题1
    luogu 4211
    loj #2319
    loj #2316
    luogu 1144
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4530581.html
Copyright © 2011-2022 走看看