题目描述
blablabla
样例
blablabla
算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
include[HTML_REMOVED]
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
vector[HTML_REMOVED] div(vector[HTML_REMOVED] &A,int b,int &r){
vector[HTML_REMOVED] C;
r=0;
for(int i=A.size()-1;i>=0;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(){
vector[HTML_REMOVED] A;
string a;
int b;
cin>>a>>b;
for(int i=a.size()-1;i>=0;i–){
A.push_back(a[i]-‘0’);
}
int r;
auto C=div(A,b,r);
for(int i=C.size()-1;i>=0;i--){
printf("%d",C[i]);
}
cout<<endl<<r<<endl;
}
算法2
(暴力枚举) $O(n^2)$
blablabla
时间复杂度
参考文献
C++ 代码
blablabla