Submission
Status:
PPPPPP-PP-
Score: 80
User: MiyaZaki1072
Problemset: Maximum Adjacent
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-16 14:07:40
#include <bits/stdc++.h>
using namespace std;
vector<long long>vec;
double calc(string x){
return stoi(x);
}
int main(){
cin.tie(0)->sync_with_stdio(0);
while(1){
string x;cin>>x;
if(x.size() == 1 && !isdigit(x[0]))break;
vec.push_back(calc(x));
}
for(int i=0;i<vec.size();i++){
bool ch=true;
if(i>0 && vec[i-1] > vec[i])ch=false;
if(i+1<vec.size() && vec[i+1] > vec[i])ch=false;
if(ch)cout<<fixed<<setprecision(0)<<vec[i]<<" ";
}
}