记录详情

Accepted

/in/foo.c: In function 'main':
/in/foo.c:32:15: warning: unused variable 'count' [-Wunused-variable]
     int sum=0,count=0;
               ^~~~~
# 状态 耗时 内存占用
#1 Accepted 1ms 208.0 KiB
#2 Accepted 1ms 128.0 KiB
#3 Accepted 0ms 220.0 KiB
#4 Accepted 0ms 128.0 KiB
#5 Accepted 0ms 220.0 KiB
#6 Accepted 0ms 228.0 KiB
#7 Accepted 0ms 216.0 KiB
#8 Accepted 0ms 128.0 KiB
#9 Accepted 0ms 216.0 KiB

代码

#include<stdio.h>


void pai(int a[],int b[],int s,int e)
{
    if(s==e) return;
int mid=(s+e)>>1;
int start1;int end1;
int k=s;int q=s;
pai(a,b,s,mid);pai(a,b,mid+1,e);
    start1=mid+1;end1=e;
   while(s<=mid&&start1<=end1)
   b[k++]=a[s]<a[start1]?a[s++]:a[start1++];
   while (s<=mid)
    b[k++]=a[s++];
   while(start1<=end1)
    b[k++]=a[start1++];
   for(int i=q;i<=e;i++)
   a[i]=b[i];

}
int a[1000],b[1000];
int main ()
{int n,max;
    scanf("%d",&n);scanf("%d",&max);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }

  pai(a,b,0,n-1);
    int sum=0,count=0;
 
for(int i=0;i<n;i++)
{
    sum+=(n-i)*a[i];
    
}
if(sum>=max)printf("Yes");
if(sum<max)printf("No");



}

信息

递交者
类型
递交
题目
P1007 hitwh 2019 新生赛 H Songer and his army
语言
C
递交时间
2020-12-18 11:11:03
评测时间
2020-12-18 11:11:03
评测机
分数
100
总耗时
7ms
峰值内存
228.0 KiB