```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a/b<<" "<<a%b;
return 0;
}
```
by _txb_ @ 2023-12-10 15:28:59
@[lilinyanzhe1012 ](https://www.luogu.com.cn/user/1048228)
by _txb_ @ 2023-12-10 15:30:52
```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
cout<<n/m<<" "<<n%m;
return 0;
}
by aochiao @ 2024-05-01 16:00:09
```cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
int x,y;
cin>>x>>y;
cout<<x/y<<" "<<x%y;
}
//——人生自古谁无死,留篇题解帮萌新——
```
by piexie0314 @ 2024-08-25 08:40:26
人机
by Chengongshun @ 2024-09-09 13:50:56
@[lilinyanzhe1012](/user/1048228)
是这样的,我们知道,在c++中,如果“/”两边是两个整数,那么结果也是整数(不四舍五入,直接去尾),so,我们的商可以直接写a/b(假设输入两数分别为a,b)
而余数,我们可以采用取余符号"%",这个符号可以取两数的余数。
### 所以代码为:
```cpp
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
cout<<a/b<<" "<<a%b;
return 0;
}
```
by DerrickDong @ 2024-09-29 21:58:19