Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: por
Problemset: เลขดวง
Language: c
Time: 0.002 second
Submitted On: 2025-09-27 12:12:24
#include<stdio.h>
int main(){
int x,y,z;
scanf("%d %d %d", &x, &y, &z);
y--;
int arr[x / 7 +1][7];
for(int i=0;i<x/7+1;i++){
for(int j=0;j<7;j++){
arr[i][j]=0;
}
}
int row =0, col=y, day=1;
while(day <= x) {
arr[row][col]=day++;
col++;
if( col==7){
col =0;
row++;
}
}
for(int i=0 ;i<row;i++){
for(int j=0 ; j<7;j++){
//printf("%d " ,arr[i][j]);
}
// printf("\n");
}
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// z
int n=0,m=0;
for(int i=0;i<x/7+1;i++){
for(int j=0;j<7;j++){
if(arr[i][j]== z){
//printf("%d %d", i, j);
n=i;
m=j;
}
}
}
int sum=0;
for(int i=0;i<x/7+1;i++){
for(int j=0;j<7;j++){
if(i==n-1&&j==m){
sum+=arr[i][j];
}
else if(i==n+1&&j==m){
sum+=arr[i][j];
}
else if(i==n&&j==m-1){
sum+=arr[i][j];
}
else if(i==n&&j==m+1){
sum+=arr[i][j];
}
}
}
printf("%d", sum);
return 0;
}