1 solutions
-
1
#include<bits/stdc++.h> using namespace std; const int N=100010; int a[N],c[N]; int main() { string s; cin>>s; int b; cin>>b; for(int i=0;i<s.size();i++) { a[i]=s[i]-'0'; } int t=0; for(int i=0;i<s.size();i++) { t=t*10+a[i]; c[i]=t/b; t%=b; } int lenc=s.size(); reverse(c,c+lenc); while(lenc>0&&c[lenc]==0) lenc--; for(int i=lenc;i>=0;i--) cout<<c[i]; cout<<endl; cout<<t; return 0; }
- 1
Information
- ID
- 146
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 43
- Accepted
- 15
- Uploaded By