1017 A除以B

1017 A除以B_第1张图片

#include
using namespace std;
int main(){
	string s;
	vectors1;
	vectorans;
	int b;
	cin>>s>>b;
	if(s.size()==1){
		int k=s[0]-'0';
		if(k>=b){
			cout<=b){
			int k=s1[i]-'0';
			k=cnt*10+k;
			cnt=k%b;
			pre=cnt;
			s1[i]=k%b+'0';
			k=k/b;
			ans.push_back(k+'0');
		
		}else{
			int k1=s1[i]-'0';
			//int k2=s1[i+1]-'0';
			k1=pre*10+k1;
			s1[i]=k1%b+'0';
			cnt=k1%b;
			pre=cnt;
			int k3=k1/b;
			ans.push_back(k3+'0');
		}
	}
//		int k1=cnt;
//			int k2=s1[s.size()-1]-'0';
//			k1=k1*10+k2;
//			cnt=k1%b;
//			int k3=k1/b;
//			ans.push_back(k3+'0');
	int r;
	r=cnt;
	int flag=0;
	for(int i=0;i

你可能感兴趣的:(pat乙级,算法,c++,数据结构)