当前位置:网站首页>P2181 对角线和P1030 [NOIP2001 普及组] 求先序排列
P2181 对角线和P1030 [NOIP2001 普及组] 求先序排列
2022-07-04 22:31:00 【&volume】
目录
----------------------
题目描述
对于一个 nn 个顶点的凸多边形,它的任何三条对角线都不会交于一点。请求出图形中对角线交点的个数。
例如,66 边形:
输入格式
输入只有一行一个整数 nn,代表边数。
输出格式
输出一行一个整数代表答案。
输入输出样例
输入 #1复制
3
输出 #1复制
0
输入 #2复制
6
输出 #2复制
15
说明/提示
数据规模与约定
- 对于 50 \%50% 的数据,保证 3 \leq n \leq 1003≤n≤100。
- 对于 100 \%100% 的数据,保证 3 \leq n \leq 10^53≤n≤105
# include <bits/stdc++.h>//# include <math.h>
int main()
{
unsigned long long n=0;
using namespace std;
unsigned long long m=0;
cin>>n;
m=n*(n-1)/2*(n-2)/3*(n-3)/4;
cout<<m;
return 0;
}
--------------------------------------------------------------------------------------------------------------------------------
题目描述
给出一棵二叉树的中序与后序排列。求出它的先序排列。(约定树结点用不同的大写字母表示,且二叉树的节点个数 \le 8≤8)。
输入格式
共两行,均为大写字母组成的字符串,表示一棵二叉树的中序与后序排列。
输出格式
共一行一个字符串,表示一棵二叉树的先序。
输入输出样例
输入 #1复制
BADC BDCA
输出 #1复制
ABCD
说明/提示
【题目来源】
NOIP 2001 普及组第三题
# include <bits/stdc++.h>
using namespace std;
void stdlb (string a,string b)
{
if(a.size()>0)
{
char c=b[b.length()-1];
cout<<c;
int k=a.find(c);
stdlb(a.substr(0,k),b.substr(0,k));
stdlb(a.substr(k+1),b.substr(k,b.length()-k-1));
}}
int main()
{
string a;
cin>>a;
string b;
cin>>b;
stdlb(a,b);
return 0;
}
边栏推荐
- 9 - 类
- Redis入门完整教程:Redis使用场景
- Google Earth Engine(GEE)——Tasks升级,实现RUN ALL可以一键下载任务类型中的所有影像
- 新版判断PC和手机端代码,手机端跳转手机端,PC跳转PC端最新有效代码
- A complete tutorial for getting started with redis: Pipeline
- La prospérité est épuisée, les choses sont bonnes et mauvaises: Où puis - je aller pour un chef de station personnel?
- Google Earth Engine(GEE)——基于 MCD64A1 的 GlobFire 日常火灾数据集
- SHP data making 3dfiles white film
- The new version judges the code of PC and mobile terminal, the mobile terminal jumps to the mobile terminal, and the PC jumps to the latest valid code of PC terminal
- The difference between Max and greatest in SQL
猜你喜欢
Locust performance test - environment construction and use
Redis: redis configuration file related configuration and redis persistence
Attack and defense world misc advanced area ditf
Hit the core in the advanced area of misc in the attack and defense world
[roommate learned to use Bi report data processing in the time of King glory in one game]
【室友用一局王者荣耀的时间学会了用BI报表数据处理】
攻防世界 MISC 进阶区 hong
Erik baleog and Olaf, advanced area of misc in the attack and defense world
Redis入门完整教程:Redis Shell
sobel过滤器
随机推荐
A complete tutorial for getting started with redis: redis shell
Attack and defense world misc advanced grace-50
图片懒加载的原理
Logo special training camp section II collocation relationship between words and graphics
Redis getting started complete tutorial: publish and subscribe
In Linux, I call odspcmd to query the database information. How to output silently is to only output values. Don't do this
Sword finger offer 65 Add without adding, subtracting, multiplying, dividing
攻防世界 MISC 進階區 Erik-Baleog-and-Olaf
Attack and defense world misc advanced area can_ has_ stdio?
Redis démarrer le tutoriel complet: Pipeline
浅聊一下中间件
How to send a reliable request before closing the page
【机器学习】手写数字识别
Redis入门完整教程:Redis Shell
关于栈区、堆区、全局区、文字常量区、程序代码区
Redis: redis configuration file related configuration and redis persistence
Unity vscode emmylua configuration error resolution
Prosperity is exhausted, things are right and people are wrong: where should personal webmasters go
Locust performance test - environment construction and use
Wake up day, how do I step by step towards the road of software testing