【CodeForces】[630C]Lucky Numbers

文章字数:116

问题描述

问题分析

lucky numbers
也就是只包含7或8的数字

问不超过n位的lucky numbers有多少
一道排列组合题目

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include<stdio.h>
#include<math.h>
int main() {
	long long a[60]= {0};
	for(int i=1; i<56; i++)
		a[i]=pow(2,i)+a[i-1];
	int n;
	while(scanf("%d",&n)!=EOF) {
		printf("%lld\n",a[n]);
	}
	return 0;
}

题目地址:【CodeForces】[630C]Lucky Numbers

该内容采用 CC BY-NC-SA 4.0 许可协议。

如果对您有帮助或存在意见建议,欢迎在下方评论交流。

加载中...