aboutsummaryrefslogtreecommitdiff
path: root/challenge-276/deadmarshal/d/ch1.d
blob: 6ccb6559d0b0ef0a116f412f9b22d77cbe0083ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import std.stdio:writeln;

int complete_day(int[] arr)
{
  int count = 0;
  foreach(i;0..arr.length-1)
    foreach(j;i+1..arr.length)
      if((arr[i] + arr[j]) % 24 == 0) count++;
  return count;
}

void main()
{
  writeln(complete_day([12,12,30,24,24]));
  writeln(complete_day([72,48,24,55]));
  writeln(complete_day([12,18,24]));
}