  Consider the linear congruence equation $x_1+\ldots+x_k \equiv b\,(\text{mod
} n)$ for $b,n\in\mathbb{Z}$. By $(a,b)_s$, we mean the largest
$l^s\in\mathbb{N}$ which divides $a$ and $b$ simultaneously. For each $d_j|n$,
define $\mathcal{C}_{j,s} = \{1\leq x\leq n^s | (x,n^s)_s = d^s_j\}$. Bibak et
al. gave a formula using Ramanujan sums for the number of solutions of the
above congruence equation with some gcd restrictions on $x_i$. We generalize
their result with generalized gcd restrictions on $x_i$ by proving that for the
above linear congruence, the number of solutions is
$$\frac{1}{n^s}\sum\limits_{d|n}c_{d,s}(b)\prod\limits_{j=1}^{\tau(n)}\left(c_{\frac{n}{d_j},s}(\frac{n^s}{d^s})\right)^{g_j}$$
where $g_j = |\{x_1,\ldots, x_k\}\cap \mathcal{C}_{j,s}|$ for $j=1,\ldots
\tau(n)$ and $c_{d,s}$ denote the generalized ramanujan sum defined by E.
Cohen.
