提交记录 #274
提交时间:2024-11-19 16:15:03
语言:c
状态:Unaccepted
编译情况:编译成功
code.c: In function ‘main’:
code.c:7:11: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘short int *’ [-Wformat=]
7 | scanf("%d",&n);
| ~^ ~~
| | |
| | short int *
| int *
| %hd
code.c:10:15: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘short int *’ [-Wformat=]
10 | scanf("%d",&a[i]);
| ~^ ~~~~~
| | |
| | short int *
| int *
| %hd
固定测试点#1:
固定测试点#2:
固定测试点#3:
附加测试点暂不可用
39【学长出题】寒冷的北京
#include<stdio.h>
short int a[10000]={0},count[10000][2]={0};
short int i,j=0,n,k=0,max=0,champion;
int main()
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
if(getchar()==' ')
{
continue;
}
}
if(n==1)
{
printf("1 1\n");return 0;
}
else
{
for(i=0;i<n-1;i++)
{
if(a[i]>=a[i+1])
{
count[k][0]=i;
for(j=i;j<n-1;j++)
{
if(a[j]<a[j+1])
{
i=j;break;
}
}
count[k][1]=j;
if(count[k][1]-count[k][0]>=max)
{
max=count[k][1]-count[k][0];champion=k;
}
k=k+1;
}
}
if(count[0][0]==0)
{
printf("1 1\n");return 0;
}
}
//printf("%d\n",max);
printf("%d %d\n",count[champion][0]+1,count[champion][1]+1);return 0;
return 0;
}