-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Chunga_Changa.cpp
More file actions
54 lines (51 loc) · 1.12 KB
/
A_Chunga_Changa.cpp
File metadata and controls
54 lines (51 loc) · 1.12 KB
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
44
45
46
47
48
49
50
51
52
53
54
// Jai shree ram
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int g1, g2, c;
cin >> g1 >> g2 >> c;
int ans = 0;
int debt = 0;
ans += g1 / c + g2 / c;
// g1 -= g1 / c;
// g2 -= g2 / c;
if (g1 % c >= g2 % c and g1 % c != 0 and g2 % c != 0)
{
// ans++;
// cout << g1 << " " << c << " " << g1 / c << '\n';
// cout << g1 % c << '\n';
// cout << g1 << " " << c << " " << g1 / c << '\n';
// cout << g2 % c << '\n';
// debt += c - g2 % c;
if (g2 % c >= c - g1 % c)
{
ans++;
debt += c - g1 % c;
}
}
else if (g1 % c < g2 % c and g1 % c != 0 and g2 % c != 0)
{
// ans++;
// debt += c - g2 % c;
if (g1 % c >= c - g2 % c)
{
ans++;
debt += c - g2 % c;
}
}
cout << ans << " " << debt;
return;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
// cin >> t;
while (t--)
{
solve();
}
}