Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: NovemNotes
Problemset: เลขดวง
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-15 11:22:40
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
// 6 7
vector<vector<int>> cal(10,vector<int>(10,0));
int day,st,want,x,y;
cin >> day >> st >> want;
int now=1;
int stx=1,sty=st;
while(now<=day){
if(now==want){
x=stx,y=sty;
}
cal[stx][sty]=now++;
sty++;
if(sty==8){
sty=1;
stx++;
}
}
// for(int i=1;i<=6;i++){
// for(int j=1;j<=7;j++){
// if(cal[i][j]>0){
// if(cal[i][j]<10){
// cout << " " << cal[i][j];
// }else{
// cout << cal[i][j];
// }
// cout << " ";
// }else
// cout << " ";
// }
// cout << "\n";
// }
int left = cal[x][y-1],right = cal[x][y+1] , up = cal[x-1][y],down = cal[x+1][y];
// cout << up << " " << down << " " << left << " " << right << "\n";
cout << up+down+right+left << "\n";
return 0;
}