Click
Here to go back to the homepage.
Early Winter Solution:
#include <bits/stdc++.h>
using namespace std;
int main(){
// #ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// #endif
int n_years, d_m;
cin >> n_years >> d_m;
bool year_exists = false;
for (int i = 0; i < n_years; ++i)
{
int d_m_for_i_year;
cin >> d_m_for_i_year;
if(d_m_for_i_year <= d_m){
year_exists = true;
cout << "It hadn't snowed this early in " << i <<" years!";
break;
}
}
if(!year_exists){
cout << "It had never snowed this early!";
}
return 0;
}