| #!/bin/bash | |
| # | |
| # deboot.sh | |
| # script to build Ubuntu rootfs (for arm64, armhf, powerpc, ppc64el) | |
| # | |
| # Copyright 2017 knotdevel | |
| # Released under the MIT license | |
| # http://opensource.org/licenses/mit-license.php | |
| # | |
| # |
| # First look what happens with a simple but naive approach. | |
| # I'll try recreating the branch in-place and merging in changes from the old version. | |
| # Should be easy, right? svn never forgets, right? ... | |
| cd ~/mybranch | |
| SVH=/repo/root | |
| # (for this approach we need the rev #'s for the start and end of the branch) | |
| START_REV=$(svn log --stop-on-copy | grep '^r[0-9]' | tail -n 1 | sed s/^r// | awk '{print $1}') | |
| END_REV=$(svn log --stop-on-copy | grep '^r[0-9]' | head -n+1 | sed s/^r// | awk '{print $1}') |
There is a cleaning robot which is cleaning a rectangular grid of size Nx M, represented by array R consisting of N strings. Rows are numbered from 0 to N-1 (from top to bottom) and columns are numbered from 0 to M-1 (from left to right).
The robot starts cleaning in the top-left corner, facing rightwards. It moves in a straight line for as long as it can, i.e. while there is an unoccupied grid square ahead of it. When it cannot move forward, it rotates 90 degrees clockwise and tries to move forward again until it encounters another obstacle, and so on. Dots in the array (".") represent empty squares and "X"s represent occupied squares (ones the robot cannot move through). Each square that the robot occupied at least once is considered clean. The robot moves indefinitely.
Write a function:
int solution (vector<string> &R);
that, given an array R consisting of N strings, each of length M, representing the grid, returns the number of clean squares.
Examples:
| ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/id_rsa | |
| ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/github_rsa | |
| ssh-keygen -t rsa -b 4096 -N '' -C "[email protected]" -f ~/.ssh/mozilla_rsa |
| /* | |
| * This program is free software: you can redistribute it and/or modify | |
| * it under the terms of the GNU General Public License as published by | |
| * the Free Software Foundation, either version 3 of the License, or | |
| * (at your option) any later version. | |
| */ | |
| #include <arpa/inet.h> | |
| #include <linux/if_packet.h> | |
| #include <stdio.h> |
| # Remove previous installations | |
| sudo apt-get remove vim vim-runtime vim-tiny vim-common | |
| # Install dependencies | |
| sudo apt-get install libncurses5-dev python-dev libperl-dev ruby-dev liblua5.2-dev | |
| # Fix liblua paths | |
| sudo ln -s /usr/include/lua5.2 /usr/include/lua | |
| sudo ln -s /usr/lib/x86_64-linux-gnu/liblua5.2.so /usr/local/lib/liblua.so |