temporary: no dependency on cpplint

This commit is contained in:
Krishna Vedala 2020-05-30 00:01:27 -04:00
parent 2bf0c00e90
commit 153fb7b8a5
2 changed files with 12 additions and 17 deletions

View File

@ -146,6 +146,7 @@ jobs:
- run: git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
- run: git pull
- run: git diff --diff-filter=dr --name-only origin/master > git_diff.txt
- run: echo "Files changed-- `cat diff.txt`"
- name: cpplint_modified_files
shell: python
run: |
@ -193,12 +194,11 @@ jobs:
if bad_files:
sys.exit(bad_files)
build:
name: Compile checks
runs-on: ${{ matrix.os }}
# needs: [cpplint, update_directory_md, cpplint_modified_files]
needs: [update_directory_md, cpplint_modified_files]
needs: [update_directory_md]
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]

View File

@ -9,25 +9,23 @@ square (so that it could tour the board again immediately, following
the same path), the tour is closed; otherwise, it is open.
**/
using namespace std;
bool issafe(int x, int y, int sol[n][n])
{
using std::cin;
using std::cout;
bool issafe(int x, int y, int sol[n][n]) {
return (x < n && x >= 0 && y < n && y >= 0 && sol[x][y] == -1);
}
bool solve(int x, int y, int mov, int sol[n][n], int xmov[n], int ymov[n])
{
bool solve(int x, int y, int mov, int sol[n][n], int xmov[n], int ymov[n]) {
int k, xnext, ynext;
if (mov == n * n)
return true;
for (k = 0; k < 8; k++)
{
for (k = 0; k < 8; k++) {
xnext = x + xmov[k];
ynext = y + ymov[k];
if (issafe(xnext, ynext, sol))
{
if (issafe(xnext, ynext, sol)) {
sol[xnext][ynext] = mov;
if (solve(xnext, ynext, mov + 1, sol, xmov, ymov) == true)
@ -38,8 +36,7 @@ bool solve(int x, int y, int mov, int sol[n][n], int xmov[n], int ymov[n])
}
return false;
}
int main()
{
int main() {
// initialize();
int sol[n][n];
@ -54,10 +51,8 @@ int main()
bool flag = solve(0, 0, 1, sol, xmov, ymov);
if (flag == false)
cout << "solution doesnot exist \n";
else
{
for (i = 0; i < n; i++)
{
else {
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) cout << sol[i][j] << " ";
cout << "\n";
}