Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* e156 - 1 */
- /* AC (3ms, 292KB) */
- #include <cstdio>
- using namespace std;
- unsigned int n;
- class Temp
- {
- public:
- Temp(){++N; Sum += N;}
- static void Reset() {N = 0; Sum = 0;}
- static unsigned int GetSum() {return Sum;}
- private:
- static unsigned int N;
- static unsigned int Sum;
- };
- unsigned int Temp::N = 0;
- unsigned int Temp::Sum = 0;
- unsigned int Sum_Solution(unsigned int n)
- {
- Temp::Reset();
- Temp *a = new Temp[n];
- delete []a;
- a = NULL;
- return Temp::GetSum();
- }
- int main()
- {
- scanf("%u", &n);
- printf("%u", Sum_Solution(n));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement