当前位置:网站首页>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;
}边栏推荐
- 集群的概述与定义,一看就会
- 质量体系建设之路的分分合合
- 攻防世界 MISC 进阶区 can_has_stdio?
- NFT insider 64: e-commerce giant eBay submitted an NFT related trademark application, and KPMG will invest $30million in Web3 and metauniverse
- Redis入门完整教程:Redis Shell
- Breakpoint debugging under vs2019 c release
- How to send a reliable request before closing the page
- 攻防世界 MISC 高手进阶区 001 normal_png
- 小程序vant tab组件解决文字过多显示不全的问题
- About stack area, heap area, global area, text constant area and program code area
猜你喜欢

Persistence mechanism of redis

Unity Xiuxian mobile game | Lua dynamic sliding function (specific implementation of three source codes)

Redis démarrer le tutoriel complet: Pipeline

攻防世界 MISC 进阶 glance-50

Redis入门完整教程:有序集合详解

MYSQL架构——用户权限与管理

Redis的持久化机制

Redis入門完整教程:Pipeline

Serial port data frame

质量体系建设之路的分分合合
随机推荐
NFT Insider #64:电商巨头eBay提交NFT相关商标申请,毕马威将在Web3和元宇宙中投入3000万美元
Li Kou 98: verify binary search tree
About stack area, heap area, global area, text constant area and program code area
[the 2023 autumn recruitment of MIHA tour] open [the only exclusive internal push code of school recruitment eytuc]
Test will: bug classification and promotion solution
Solana chain application crema was shut down due to hacker attacks
The Sandbox 和数字好莱坞达成合作,通过人力资源开发加速创作者经济的发展
Attack and defense world misc master advanced zone 001 normal_ png
Google Earth engine (GEE) - tasks upgrade enables run all to download all images in task types with one click
Attack and defense world misc advanced zone 2017_ Dating_ in_ Singapore
醒悟的日子,我是怎么一步一步走向软件测试的道路
Redis getting started complete tutorial: publish and subscribe
攻防世界 MISC 进阶区 Erik-Baleog-and-Olaf
[Lua] Int64 support
繁华落尽、物是人非:个人站长该何去何从
Erik baleog and Olaf, advanced area of misc in the attack and defense world
攻防世界 MISC 進階區 Erik-Baleog-and-Olaf
攻防世界 MISC 进阶区 can_has_stdio?
啃下大骨头——排序(二)
MYSQL架构——用户权限与管理