Skip to content

Instantly share code, notes, and snippets.

@feis
Created June 15, 2015 08:32
Show Gist options
  • Save feis/1ff45ffdd71c0d3a0849 to your computer and use it in GitHub Desktop.
Save feis/1ff45ffdd71c0d3a0849 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
int getID(int Fpass, int Fstop) {
const int i = Fpass / 60;
return (19 - i) * i / 2 + (Fstop - Fpass) / 60 - 1;
}
int main() {
int Fpass, Fstop;
const int begin = 0;
const int end = 540;
const int step = 60;
for (Fpass = begin; Fpass <= end; Fpass += step) {
for (Fstop = Fpass + step; Fstop <= end; Fstop += step) {
printf("%d %d %d\n", Fpass, Fstop, getID(Fpass, Fstop));
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment