版本比较
P7072 [CSP-J2020] 直播获奖 题解
正文
增加 4 行删除 4 行
13 行未改动1415161718181920212223242223242526272829 行未改动13 行未改动const int N=1e5+5;//定义数组大小最大值常量int n,w,a[N];bool cmp(int x,int y) { return x>y;}//从大到小排序 }//从大到小排序int main() { cin>>n>>w; for(int i=1; i<=n; i++) { scanf("%d",&a[i]);//使用scanf提高速度 sort(a+1,a+i+1,cmp);//排序 printf("%d ",a[max(1,i*w/100)]);//使用printf提高速度 scanf("%d",&a[i]);//使用scanf提高速度 sort(a+1,a+i+1,cmp);//排序 printf("%d ",a[max(1,i*w/100)]);//使用printf提高速度 } return 0;}```29 行未改动