Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int years[48]={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- int n, yop, seq=0;
- string y="";
- cin>>n;
- for(int i=0;i<n;i++) {
- cin>>yop;
- y+=yop;
- }
- for(int i=0;i<(48-n);i++) {
- for(int j=0; j<n;j++){
- if(y[i+j]==years[i+j]) seq++;
- else break;
- }
- if(seq==n) {
- cout<<"YES";
- return 0;
- }
- seq = 0;
- }
- cout<<"NO"
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement