当前位置:网站首页>聪明的美食家 C语言
聪明的美食家 C语言
2022-07-26 08:53:00 【jeff one】
聪明的美食家 C语言
题目描述:
如果有人认为吃东西只需要嘴巴,那就错了。
都知道舌头有这么一个特性,“由简入奢易,由奢如简难”(据好事者考究,此规律也适合许多其他情况)。具体而言,如果是甜食,当你吃的食物不如前面刚吃过的东西甜,就很不爽了。
大宝是一个聪明的美食家,当然深谙此道。一次他来到某小吃一条街,准备从街的一头吃到另一头。为了吃得爽,他大费周章,得到了各种食物的“美味度”。他拒绝不爽的经历,不走回头路而且还要爽歪歪(爽的次数尽量多)。
输入:
输入描述:
两行数据。
第一行为一个整数n,表示小吃街上小吃的数量
第二行为n个整数,分别表示n种食物的“美味度”
输入样例:
10
3 18 7 14 10 12 23 41 16 24
输出:
输出描述:
一个整数,表示吃得爽的次数
输出样例:
6
提示:
HINT:时间限制:1.0s 内存限制:256.0MB
美味度为0到100的整数
n<1000
来源:
蓝桥杯练习系统 ID: 320 原题链接: http://lx.lanqiao.cn/problem.page?gpid=T320
#include <stdio.h>
int a[1010],b[1010],i,j,k;
int main()
{
int num;
scanf("%d",&num);
for(i=1;i<=num;i++)
scanf("%d",&a[i]);
for(i=1;i<=num;i++)
b[i]=1;
for(i=1;i<=num;i++)
{
for(j=1;j<i;j++)//从第一个数到i
{
if(a[i]>=a[j])
{
b[i]=b[i]>b[j]+1?b[i]:b[j]+1;
}
}
}
k=1;
for(i=num;i>=0;i--)
if(k<b[i])
{
k=b[i];
}
printf("%d",k);
return 0;
}
边栏推荐
- Arbitrum launched the anytrust chain to meet the diverse needs of ecological projects
- 2000年的教训。web3是否=第三次工业革命?
- Regular expression: judge whether it conforms to USD format
- Review notes of Microcomputer Principles -- zoufengxing
- day06 作业--增删改查
- Ueditot_ JSP SSRF vulnerability recurrence
- Espressif plays with the compilation environment
- TCP solves the problem of short write
- 【加密周报】加密市场有所回温?寒冬仍未解冻 盘点上周加密市场发生的重大事件
- Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
猜你喜欢

Day06 homework -- skill question 2

Pop up window in Win 11 opens with a new tab ---firefox
![[untitled]](/img/3e/fb7c4d901643e6ea88a7d90ead045c.png)
[untitled]

CSDN TOP1“一个处女座的程序猿“如何通过写作成为百万粉丝博主?

Database operation topic 1

03 exception handling, state keeping, request hook -- 04 large project structure and blueprint

Learning notes of automatic control principle --- linear discrete system

【数据库 】GBase 8a MPP Cluster V95 安装和卸载

unity TopDown角色移动控制

Set of pl/sql
随机推荐
[untitled]
Replication of SQL injection vulnerability in the foreground of Pan micro e-cology8
day06 作业---技能题7
[recommended collection] MySQL 30000 word essence summary index (II) [easy to understand]
PAT 甲级 A1076 Forwards on Weibo
Web overview and b/s architecture
Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
PXE principles and concepts
pl/sql之动态sql与异常
Pxe原理和概念
【LeetCode数据库1050】合作过至少三次的演员和导演(简单题)
After MySQL 8 OCP (1z0-908), hand in your homework
Sklearn machine learning foundation (linear regression, under fitting, over fitting, ridge regression, model loading and saving)
Typescript encryption tool passwordencoder
Oracle 19C OCP 1z0-082 certification examination question bank (30-35)
NFT与数字藏品到底有何区别?
Kotlin properties and fields
Huffman transformation software based on C language
Overview of motion recognition evaluation
Nuxt - 项目打包部署及上线到服务器流程(SSR 服务端渲染)