File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed
Solved Archive/1107_remote_controller Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ using namespace std ;
3
+
4
+ // input_data[0]: the distance a snail goes up in daytime.
5
+ // input_data[1]: the distance the snail slep down at night.
6
+ // input_data[2]: the distance the snail need to go up.
7
+
8
+ int * get_input () {
9
+ int * data = new int [3 ];
10
+ for (int i = 0 ; i < 3 ; ++i)
11
+ cin >> data[i];
12
+ return data;
13
+ }
14
+
15
+ int calculate_date (int * data) {
16
+ int ans = (data[2 ] - data[0 ]) / (data[0 ] - data[1 ]) + (((data[2 ] - data[0 ]) % (data[0 ] - data[1 ]) == 0 ) ? 0 : 1 ) + 1 ;
17
+ delete [] data;
18
+ return ans;
19
+ }
20
+
21
+ void printInt (int message) {
22
+ cout << message << ' \n ' ;
23
+ }
24
+
25
+ int main () {
26
+ printInt (calculate_date (get_input ()));
27
+ return 0 ;
28
+ }
File renamed without changes.
File renamed without changes.
You can’t perform that action at this time.
0 commit comments