Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string a,b,c;
- cin>>a>>b>>c;
- int den1=0;
- den1=den1*10+(a[0]-'0');
- den1=den1*10+(a[1]-'0');
- bool h1=true;
- if(den1>31 || den1<1) h1=false;
- else{
- int mesec1=0;
- mesec1=mesec1*10+(a[2]-'0');
- mesec1=mesec1*10+(a[3]-'0');
- if(mesec1>12 || mesec1<1) h1=0;
- else{
- int god1=0;
- god1=god1*10+(a[4]-'0');
- god1=god1*10+(a[5]-'0');
- god1=god1*10+(a[6]-'0');
- bool prestapna=false;
- if((god1%100==0 and god1%400==0) or god1%4==0) prestapna=true;
- if(mesec1==4 or mesec1==6 or mesec1==9 or mesec1==11 and den1>30) h1=0;
- else if(mesec1==2 and den1<=28 and prestapna==true) h1=0;
- else if(mesec1==2 and den1>=29 and prestapna==false) h1=0;
- if(a[7]!='1' and a[7]!='6' and a[7]!='9') h1=0;
- int cnt=0;
- for(int i=0;i<8;i++) cnt+=(a[i]-'0')*(a[i]-'0');
- if(cnt%7!=(a[8]-'0')) h1=0;
- if(h1==0) cout<<0<<endl;
- else cout<<1<<endl;
- }
- }
- int den2=0;
- den2=den2*10+(b[0]-'0');
- den2=den2*10+(b[1]-'0');
- bool h2=true;
- if(den2>31 || den2<1) h2=false;
- else{
- int mesec1=0;
- mesec1=mesec1*10+(b[2]-'0');
- mesec1=mesec1*10+(b[3]-'0');
- if(mesec1>12 || mesec1<1) h2=0;
- else{
- int god1=0;
- god1=god1*10+(b[4]-'0');
- god1=god1*10+(b[5]-'0');
- god1=god1*10+(b[6]-'0');
- bool prestapna=false;
- if((god1%100==0 and god1%400==0) or god1%4==0) prestapna=true;
- if(mesec1==4 or mesec1==6 or mesec1==9 or mesec1==11 and den2>30) h2=0;
- if(mesec1==2 and den2<=28 and prestapna==true) h2=0;
- if(mesec1==2 and den2>=29 and prestapna==false) h2=0;
- if(b[7]!='1' and b[7]!='6' and b[7]!='9') h2=0;
- int cnt=0;
- for(int i=0;i<8;i++) cnt+=(b[i]-'0')*(b[i]-'0');
- if(cnt%7!=(b[8]-'0')) h2=0;
- if(h2==0) cout<<0<<endl;
- else cout<<1<<endl;
- }
- }
- int den3=0;
- den3=den3*10+(c[0]-'0');
- den3=den3*10+(c[1]-'0');
- bool h3=true;
- if(den3>31 || den3<1) h3=false;
- else{
- int mesec1=0;
- mesec1=mesec1*10+(c[2]-'0');
- mesec1=mesec1*10+(c[3]-'0');
- if(mesec1>12 || mesec1<1) h3=0;
- else{
- int god1=0;
- god1=god1*10+(c[4]-'0');
- god1=god1*10+(c[5]-'0');
- god1=god1*10+(c[6]-'0');
- bool prestapna=false;
- if((god1%100==0 and god1%400==0) or god1%4==0) prestapna=true;
- if(mesec1==4 or mesec1==6 or mesec1==9 or mesec1==11 and den3>30) h3=0;
- else if(mesec1==2 and den3<=28 and prestapna==true) h3=0;
- else if(mesec1==2 and den3>=29 and prestapna==false) h3=0;
- if(c[7]!='1' and c[7]!='6' and c[7]!='9') h3=0;
- int cnt=0;
- for(int i=0;i<8;i++) cnt+=(c[i]-'0')*(c[i]-'0');
- if(cnt%7!=(c[8]-'0')) h3=0;
- }
- }
- if(h3==0) cout<<0<<endl;
- else cout<<1<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement