Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- void co(vector <int> v){
- for (auto &x: v) cout<<x<<' ';
- cout<<'\n';
- }
- vector <int> cal = {-1, 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 dst = 0;
- int day = -1, month = -1, year = -1, fst = -1;//first jan
- void dist(){
- for (int i = 1;i<=12;++i){
- cout<<"mnth = "<<i<<'\n';
- if (i == month){
- cout<<" += "<<day<<'\n';
- dst += day;
- break;
- }
- else{
- cout<<"+= "<<cal[i]<<'\n';
- dst += cal[i];
- }
- }
- }
- int main()
- {
- cin>>day>>month>> year>>fst;
- if (year % 4 == 0 && year % 100 != 0) {
- cal[2] = 29;
- //cal[4] = 31;
- }
- else if (year % 4 == 0 && year % 100 == 0 && year % 400 == 0){
- cal[2] = 29;
- }
- dist();
- cout<<"dst = "<<dst<<'\n';
- int ans;
- ans = ( fst + dst - 1) % 7;
- if (ans == 0) ans = 7;
- cout<<ans;
- }
- /*
- 29 02 2016 5
- 1+
- 01 01 2010 5
- 5+
- 31 12 2010 5
- 5 +
- 30 12 2010 5
- 4+
- 29 12 2010 5
- 3+
- 28 12 2010 5
- 2+
- 27 12 2010 5
- 1+
- 26 12 2010 5
- 7+
- 26 12 2016 5
- 1+
- 26 12 2000 6
- 2+
- 26 12 1900 1
- 3+
- */
- //07 01 312 01
- //7+
Add Comment
Please, Sign In to add comment