Submission
Status:
PP-PPP--PP
Subtask/Task Score:
70/100
Score: 70
User: limsan20122
Problemset: เลขดวง
Language: cpp
Time: 0.003 second
Submitted On: 2025-10-02 18:39:22
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int x=0;
int y=0;
int z=0;
int a=0;
int b=0;
int c=0;
int d=0;
int e=0;
cin >> x >> y >> z;
int calendar[5][7]={0};
for(int i=0;i<5;i++){
for(int j=0;j<7;j++){
if((i==0 && j>(y-2)) || i>0) a++;
if((i==0 && j>y-2) || (i>0 && i<4) || (i==4 && j<x-(29-y))) calendar[i][j]=a;
}
}
/*for(int i=0;i<5;i++){
for(int j=0;j<7;j++){
cout << calendar[i][j] << "\t";
}
cout << "\n";
}*/
for(int i=0;i<5;i++){
for(int j=0;j<7;j++){
if(calendar[i][j]==z){
b=i;
c=j;
d++;
break;
}
}
if(d==1) break;
}
if((b+2)>5) e+=0;
else e+=(calendar[b+1][c]);
if(b<1) e+=0;
else e+=(calendar[b-1][c]);
if(c<1) e+=0;
else e+=(calendar[b][c-1]);
if((c+2)>5)e+=0;
else e+=(calendar[b][c+1]);
cout << e << endl;
return 0;
}