Gym
来源:互联网 发布:apache storm 介绍 编辑:程序博客网 时间:2024/06/16 20:29
题目链接:https://vjudge.net/problem/Gym-101243H
题意:给你一个数n,让你求有多少个不同的n位数,而且从左往右数第i位不能为i,其实不能有前导零
解析:其实就是个排列组合的问题吧,第一位只能放8个数,第二位一直到第9位能放9位数,其他可以放10位数,直接输出即可
#include <iostream>#include <cstring>#include <string>#include <cstdio>#include <algorithm>#include <cmath>#include <vector>#include <map>using namespace std;const int maxn = 1e5+100;const int mod = 1e9+7;int main(){ freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); int n; scanf("%d",&n); long long ans = 8; if(n<=9) { for(int i=1;i<n;i++) ans *= 9; printf("%I64d\n",ans); } else { printf("344373768"); for(int i=0;i<n-9;i++) printf("0"); puts(""); } return 0;}
0 0
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- Gym
- SylixOS中TPSFS格式化流程简析
- 系统服务之下载管理(DownloadManager)
- 11、一个简单的更美APP美购项目爬虫
- 自然语言处理——TF-IDF算法提取关键词
- Unable to get view server version from device emulator-5554 解决办法
- Gym
- 图的邻接表和邻接矩阵
- android使用socket使底层和framework通信
- 运行项目的时候出现missing frature:WATCH
- Android6.0 在外置SD卡 读写问题.....
- WebSite---前台系统图片验证码心得
- How to upgrade Image by jigdo
- 编译Boost
- 1004. 成绩排名 (20)