#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
vector<int> div(vector<int>&a, int b, int &r)
{
vector<int>c;
for (int i = 0; i < a.size(); i++)
{
r = r * 10 + a[i];
c.push_back(r / b);
r = r % b;
}
reverse(c.begin(), c.end());
while (c.size() > 1 && c.back() == 0)c.pop_back();
return c;
}
int main()
{
int b;//被除数
string a;//除数
int r = 0;//余数
cin >> a >> b;
vector<int>c;
for (int i = 0; i < a.size(); i++)c.push_back(a[i] - '0');
auto d = div(c,b,r);
for (int i = d.size() - 1; i >= 0; i--)cout << d[i];
cout << endl;
cout << r;
}
08-12
1120
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-13
560
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-09
2200
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)