【ZhengQing】[1391]Li Bai Drinking

Problem Description

Loading...

Problem Analysis

Work backwards
My first idea was wrong
It should be that one poem-writing session comes with drinking twice~

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

Problem link: ZZULI 1391 - Li Bai Drinking

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...