B1017

#include<cstdio>
#include<iostream>
using namespace std;
int main(){
string s;
int a,len,t=0;
cin>>s>>a;
len=s.length();
if(s.length()==1&&s[0]-'0'<a){
cout<<"0 "<<s[0];
return 0;
}
for(int i=0;i<s.length();i++){
t=t*10+s[i]-'0';
if(t/a!=0)
cout<<t/a;
if(t/a==0&&i!=0)
cout<<"0";
t%=a;
}
cout<<" "<<t;
return 0;
}

猜你喜欢

转载自www.cnblogs.com/tao7/p/9768259.html