Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: spammer_destroyer

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-12 12:53:48

//c1_bkk66_4
#include <iostream>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int month,first,birth,u,d,l,r,day,sum;
  cin >> month >> first >> birth;
  u=birth-7,d=birth+7,l=birth-1,r=birth+1;
  if(u<1||u>month) {
    u=0;
  }
  if(d<1||d>month) {
    d=0;
  }
  if(l<1||l>month) {
    l=0;
  }
  if(r<1||r>month) {
    r=0;
  }
  day=((birth-1)%7+first)%7;
  if(day==0){day=7;}
  if(day==1) {
    l=0;
  }
  if(day==7) {
    r=0;
  }
  sum=u+d+l+r;
  cout << sum;
}