aboutsummaryrefslogtreecommitdiff
path: root/codeforces/InfinityStaircase/InfinityStaircase.cpp
blob: aeb982a84a18eadb36418862992096004464e638 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<bits/stdc++.h>

using namespace std;

int main() {
  int tt;
  cin >> tt;
  while(tt--) {
    int n;
    cin >> n;
    n-=1;
    if(n % 5 == 0) {
      cout << (n / 5) * 2 << endl;
    } 
    else{
      if(n % 5 == 1 || n % 5 == 2 || n % 5 == 3) {
        cout << ((n / 5) * 2) + 1 << endl; 
      }
      else if(n % 5 == 4) {
        cout << ((n / 5) * 2) + 2 << endl; 
      }
    }
  }
}