2 solutions
-
0
#include<bits/stdc++.h> using namespace std; const int nm=100010; int a[nm],c[nm]; string s; int main() { 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 lc=s.size(); reverse(c,c+lc); while(lc>0&&c[lc]==0) lc--; for(int i=lc;i>=0;i--) cout<<c[i]; cout<<endl<<t; return 0; }
Information
- ID
- 146
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- (None)
- # Submissions
- 45
- Accepted
- 16
- Uploaded By