Skip to content

Commit a1dda11

Browse files
committed
Solve problem Ciel and A-B Problem from Codechef
1 parent 08a0450 commit a1dda11

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Diff for: CodeChef/Ciel and A-B Problem.cpp

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
string toString(int n) {
6+
string tmp = "";
7+
while(n) {
8+
tmp += (n % 10) + '0';
9+
n /= 10;
10+
}
11+
reverse(tmp.begin(), tmp.end());
12+
return tmp;
13+
}
14+
15+
int main() {
16+
int a, b;
17+
cin >> a >> b;
18+
string c = toString(a - b);
19+
if(c[c.length() - 1] == '9')
20+
c[c.length() - 1] = '1';
21+
else
22+
c[c.length() - 1] = '9';
23+
cout << c << endl;
24+
}
25+

Diff for: CodeChef/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Problems links
22

3+
- [Ciel and A-B Problem](https://www.codechef.com/problems/CIELAB)
34
- [Compilers and parsers](https://www.codechef.com/problems/COMPILER)

0 commit comments

Comments
 (0)