-
Notifications
You must be signed in to change notification settings - Fork 0
/
suite.cpp
43 lines (32 loc) · 824 Bytes
/
suite.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
using namespace std;
int main()
{
int debut(0);
do {
cout << "de (>= 1) ? ";
cin >> debut;
} while (debut < 1);
int fin(0);
do {
cout << "a (>= " << debut << ") ? ";
cin >> fin;
} while (fin < debut);
for(int i(debut); i <= fin; ++i){
int counter = 0;
int n = i;
do { if ( n % 3 == 0 ) {
n += 4;
counter += 1;
} else if ( n % 4 == 0 ){
n /= 2;
counter += 1;
} else {
n -= 1;
counter += 1;
}
} while (n != 0);
cout << i << "->" << counter << endl;
}
return 0;
}