C++编程《第19课 综合训练1》教学课件.pptxVIP

  • 1
  • 0
  • 约1.04千字
  • 约 28页
  • 2026-03-13 发布于广西
  • 举报

C++编程《第19课 综合训练1》教学课件.pptx

第19课;学习目标;课堂练习;(一)[COI2007]Patrik音乐会的等待;(一)[COI2007]Patrik音乐会的等待;(一)[COI2007]Patrik音乐会的等待(暴力模拟);人员编号;人员编号;#includebits/stdc++.h

usingnamespacestd;

inta[500001],top;

intn;

intmain(){

cinn;

longlongans=0;

intx;

for(inti=1;i=n;i++){//for1

scanf(%d,x);

while(top0a[top]x){//剔除所有矮人

top--;//矮人视野被挡住,后面不必再统计

ans++;//能看见矮人

}//endwhile;

;(一)[COI2007]Patrik音乐会的等待(栈+模拟+二分查找);#includebits/stdc++.h

usingnamespacestd;

inta[500001],top;

intn;

intmain(){

cinn;

longlongans=0;

intx;

for(inti=1;i=n;i++){

scanf(%d,x);

intp=upper_bound(a+1,a+top

文档评论(0)

1亿VIP精品文档

相关文档