#40451: 簡潔有力


yp11251273@yphs.tp.edu.tw (906-36張鈞勉)


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n/*建築數量*/,m/*小明家的位置*/,xi[1001]={}/*建築物的高度*/,sum/*小明能夠觀看到的建築物數量*/,tallest/*目前高度*/;
    while(cin>>n>>m){
        sum=0;//初始值 
        for(int i=1;i<=n;i++){//n次 
            cin>>xi[i];//第i棟建築物的高度
        }
        tallest=xi[m];//小明家的位置為基準,左看 
        for(int j=m+1;j<=n;j++){
            if(xi[j]>tallest) {tallest=xi[j] , sum++;}//","一起執行 
        }
        tallest=xi[m];//小明家的位置為基準,右看 
        for(int k=m-1;k>=1;k--){
            if(xi[k]>tallest) {tallest=xi[k] , sum++;}//","一起執行 
        }
        cout<<sum<<endl;
    }
    return 0;
}

#40452: Re: 簡潔有力


yp11251123@yphs.tp.edu.tw (704-39黃楷博)


太6了

 

#40453: Re: 簡潔有力


yp11251123@yphs.tp.edu.tw (704-39黃楷博)


#include <windows.h>
#include <iostream>
using namespace std;

int main()
{
  int resp;
  cout<<"!!MERRY CHRISTMAS!!"<<endl;
  cout<<"                                            "<<endl;
  cout <<"IT'S A CHRISTMAS GIFT! PRESS ANY NUMBER AND ENTER TO PROCESS!" << endl;
  cout<<"                                            "<<endl;
  cout <<"< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>"<<endl;
  cin >> resp;
  for(int i=0; i<1; i++)
  {
    ShellExecute(NULL, "open", "https://www.youtube.com/watch?v=oHg5SJYRHA0", NULL, NULL, SW_SHOWNORMAL);
  }

}



#40543: Re: 簡潔有力


yp11251122@yphs.tp.edu.tw (70243)


#include
#include
using namespace std;

int main()
{
  int resp;
  cout<<"!!MERRY CHRISTMAS!!"<  cout<<"                                            "<  cout <<"IT'S A CHRISTMAS GIFT! PRESS ANY NUMBER AND ENTER TO PROCESS!" << endl;
  cout<<"                                            "<  cout <<"< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>< ( ̄︶ ̄)>"<  cin >> resp;
  for(int i=0; i<1; i++)
  {
    ShellExecute(NULL, "open", "https://www.youtube.com/watch?v=oHg5SJYRHA0", NULL, NULL, SW_SHOWNORMAL);
  }

}

🤬🤬🤬