Skip to main content
  1. Posts/

SPOJ AMR10F Cookies Piles

·162 words·1 min
Table of Contents
Note: This article is available in Chinese only. 本文暂无英文版本。 View original

AMR10F - Cookies Piles
#

水.

 1
 2
 3    /*************************************************************************
 4    	> File Name: code/2015summer/#4/F.cpp
 5    	> Author: 111qqz
 6    	> Email: rkz2013@126.com
 7    	> Created Time: 2015年07月29日 星期三 21时47分23秒
 8     ************************************************************************/
 9
10    #include<iostream>
11    #include<iomanip>
12    #include<cstdio>
13    #include<algorithm>
14    #include<cmath>
15    #include<cstring>
16    #include<string>
17    #include<map>
18    #include<set>
19    #include<queue>
20    #include<vector>
21    #include<stack>
22    #define y0 abc111qqz
23    #define y1 hust111qqz
24    #define yn hez111qqz
25    #define j1 cute111qqz
26    #define tm crazy111qqz
27    #define lr dying111qqz
28    using namespace std;
29    #define REP(i, n) for (int i=0;i<int(n);++i)
30    typedef long long LL;
31    typedef unsigned long long ULL;
32    const int inf = 0x7fffffff;
33    int main()
34    {
35        int T;
36        int n,a,d;
37        cin>>T;
38        while (T--)
39        {
40    	scanf("%d %d %d",&n,&a,&d);
41    	cout<<n*a+n*(n-1)/2*d<<endl;
42        }
43
44    	return 0;
45    }

Related

poj 2823 Sliding Window (单调队列)

·1773 words·4 mins
Sliding Window 看这个问题:An array of size n ≤ 106 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves rightwards by one position.Your task is to determine the maximum and minimum values in the sliding window at each position.

codeforces 442C. Artem and Array

·492 words·1 min
C. Artem and Array time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Artem has an array of n positive integers. Artem decided to play with it. The game consists of n moves. Each move goes like this. Artem chooses some element of the array and removes it. For that, he gets min(a, b) points, where a and b are numbers that were adjacent with the removed number. If the number doesn’t have an adjacent number to the left or right, Artem doesn’t get any points.

cf 442B Andrey and Problem

·712 words·2 mins
B. Andrey and Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andrey needs one more problem to conduct a programming contest. He has n friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fiends – the probability that this friend will come up with a problem if Andrey asks him.

cf 443B Kolya and Tandem Repeat

·445 words·1 min
B. Kolya and Tandem Repeat time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kolya got string s for his birthday, the string consists of small English letters. He immediately added k more characters to the right of the string.