[HDU] [2042] Not Easy Series Part Two

Problem Description

Loading...

Problem Analysis

Nice story. Let’s take a look at it.

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#include<stdio.h>
int main() {
	int T;
	scanf("%d",&T);
	while(T--) {
		int n;
		scanf("%d",&n);
		int sum=3;
		for(int i=0; i<n; i++) {
			sum--;
			sum*=2;
		}
		printf("%d\n",sum);
	}
	return 0;
}

Problem link: 【HDU】[2042] Not Easy Series Part Two

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...