Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: .n0t_gloomy.

Problemset: เลขดวง

Language: cpp

Time: 0.002 second

Submitted On: 2025-09-29 21:57:03

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int d,w,b;
    cin>>d>>w>>b;
    int x,y;
    vector<vector<int>> v (8,vector<int>(9,0));
    int col = 1;
    for(int i = 1; i <= d; i++)
    {
        v[col][w] = i;
        if (i == b)
        {
            x = col;
            y = w;
        }
        w++;
        if (w==8)
        {
            w=1; col++;
        }
    }
    // for (auto it : v)
    // {
    //     for (auto pp : it)
    //     {
    //         cout<<fixed<<setw(3)<<pp<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<(v[x-1][y] + v[x+1][y] + v[x][y-1] + v[x][y+1])<<"\n";
    return 0;
}