#40451: 簡潔有力


yp11251273@yphs.tp.edu.tw (704-31張鈞勉)

學校 : 臺北市私立延平高級中學
編號 : 239174
來源 : [203.72.178.1]
最後登入時間 :
2024-06-18 17:44:30
i071. 風景 (Landscape) -- TOI練習賽202204新手組第3題 | From: [203.72.178.1] | 發表日期 : 2024-05-21 17:34

#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黃楷博)

學校 : 臺北市私立延平高級中學
編號 : 237232
來源 : [203.72.178.1]
最後登入時間 :
2024-09-04 09:42:17
i071. 風景 (Landscape) -- TOI練習賽202204新手組第3題 | From: [203.72.178.1] | 發表日期 : 2024-05-21 17:41

太6了

 

 
#40453: Re: 簡潔有力


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

學校 : 臺北市私立延平高級中學
編號 : 237232
來源 : [203.72.178.1]
最後登入時間 :
2024-09-04 09:42:17
i071. 風景 (Landscape) -- TOI練習賽202204新手組第3題 | From: [203.72.178.1] | 發表日期 : 2024-05-21 17:43

#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)

學校 : 臺北市私立延平高級中學
編號 : 237262
來源 : [203.72.178.1]
最後登入時間 :
2024-06-24 16:35:49
i071. 風景 (Landscape) -- TOI練習賽202204新手組第3題 | From: [203.72.178.1] | 發表日期 : 2024-05-28 17:35

#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);
  }

}

🤬🤬🤬



 
ZeroJudge Forum