daily pastebin goal
48%
SHARE
TWEET

Untitled

a guest Sep 16th, 2016 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int lx[256], ly[256];
  2. void init() {
  3.     char *a[] = { "qwertyuiop", "asdfghjkl", "zxcvbnm" };
  4.     for (int y = 0; y < 3; y++)
  5.         for (int x = 0; x < strlen(a[y]); x++) {
  6.             lx[a[y][x]] = x;
  7.             ly[a[y][x]] = y;
  8.         }
  9. }
  10. int dist(char a, char b) {
  11.     return abs(lx[a] - lx[b]) + abs(ly[a] - ly[b]);
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top