12 条题解
-
1便秘 (cuiyangyang1) LV 7 @ 2024-12-6 18:45:25
抄的😄
#include<bits/stdc++.h> using namespace std; const int N=1e5+10; long long x[N],c[N]; int main(){ char a[10000]; long long y; cin>>a>>y; int len1=strlen(a); for(int i=0;i<len1;i++){ x[i]=a[i]-'0'; } long long len=0; long long ans=0; for(int i=0;i<len1;i++){ int f=0; ans=ans*10+x[i]; if(ans>=y){ f=ans/y; ans=ans%y; } c[len++]=f; } long long num=0; while(c[num]==0&&num<len){ num++; } if(num>=len){ cout<<"0"; return 0; } for(int i=num;i<len;i++){ cout<<c[i]; } return 0; }
-
02021-11-13 20:52:41@
/***************************************** 备注: ******************************************/ #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int x[N]; int c[N]; int main() { string a; LL y; cin >> a >> y; int lena = a.size(); for(int i = 0 ; i < lena ; i++) x[i] = a[i] - '0'; LL len = 0; LL ans = 0; for(int i = 0 ; i< lena ; i++) { int f = 0; ans = ans * 10 + x[i]; if(ans >= y) { f = ans/y; ans = ans % y; } c[len++] = f; } LL num = 0; while(c[num] == 0 && num < len) num++; if(num >= len) { cout << "0"; return 0; } for(int i = num ; i < len ; i++) cout << c[i]; return 0; }
-
-12023-10-25 20:07:16@
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; const int N=1e5+10; const int INF=0x3f3f3f3f; char a[N]; int a1[N],c1[N],lenc; int b,x; int main(){ cin>>a>>b; int lena=strlen(a);
for(int i=0;i<lena;i++) a1[i]=a[lena-i-1]-'0'; for(int i=lena-1;i>=0;i--){ c1[i]=(x*10+a1[i])/b; x=(x*10+a1[i])%b; } lenc=lena; while(c1[lenc]==0&&lenc>0) lenc--; for(int i=lenc;i>=0;i--) cout<<c1[i]; return 0;
}
-
-12023-10-25 20:06:43@
#include<bits/stdc++.h> using namespace std; const int n=1e5+10; const int inf=0x3f3f3f3f;
char a[n]; int la,lc,a1[n],c1[n],x,b; int main() { cin>>a>>b; la=strlen(a); for(int i=0;i<la;i++){ a1[i]=a[la-i-1]-'0'; }
for(int i=la-1;i>=0;i--){ c1[i]=(x*10+a1[i])/b; x=(x*10+a1[i])%b; } lc=la; while(c1[lc]==0 && lc>0){ lc--; } for(int i=lc;i>=0;i--){ cout<<c1[i]; } return 0;
}
-
-22024-10-22 16:45:44@
#include<iostream> using namespace std; string a; int b; const int N=1e6+532; int a1[N],lena,c1[N],lenc,yu; int main(){ cin>>a>>b; lena=a.size(); for(int i=0;i<lena;i++) { a1[i] = a[i]-'0'; } for(int i=0;i<=lena;i++) { c1[i] = (yu*10+a1[i])/b; yu = (yu*10+a1[i])%b; } while(c1[lenc]==0&&lenc <lena-1) { lenc++; } for(int i=lenc;i<=lena-1;i++) { cout<<c1[i]; } return 0; }
-
-22023-11-25 20:44:17@
#include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e6 + 10; const int INF = 0x3f3f3f3f; string a; int a1[N],c1[N],lena,lenc,yu; int main() { cin >> a>>b; lena = a.size(); for(int i = 0;i < lena;i++) { a1[i]=a[i]-'0'; } for(int i =0;i <lena;i++) { c1[i]=(yu *10+a1[i])/b; yu = (yu *10 + a1[i])%b; } while(c1[lenc] == 0&&lenc<lena - 1) { lenc++; } for(int i = lenc;i < lena;i++ { cout <<c1[i]; } return 0; }
-
-22023-11-25 20:44:00@
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> #include<string> #include<cstring> const int INF=0x3f3f3f3f; const int N=1e5+10; using namespace std; string a; int b; int a1[N],lena,c1[N],lenc,yu; int main(){ cin>>a>>b; lena=a.size(); for(int i=0;i<lena;i++) { a1[i] = a[i]-'0'; } for(int i=0;i<=lena;i++) { c1[i] = (yu*10+a1[i])/b; yu = (yu*10+a1[i])%b; } while(c1[lenc]==0&&lenc <lena-1) { lenc++; } for(int i=lenc;i<=lena-1;i++) { cout<<c1[i]; } return 0; }
-
-22023-10-29 20:26:16@
#include <bits/stdc++.h> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int x[N]; int c[N]; int main() { string a; LL y; cin >> a >> y; int lena = a.size(); for(int i = 0 ; i < lena ; i++) x[i] = a[i] - '0'; LL len = 0; LL ans = 0; for(int i = 0 ; i< lena ; i++) { int f = 0; ans = ans * 10 + x[i]; if(ans >= y) { f = ans/y; ans = ans % y; } c[len++] = f; } LL num = 0; while(c[num] == 0 && num < len) num++; if(num >= len) { cout << "0"; return 0; } for(int i = num ; i < len ; i++) cout << c[i]; return 0; }
-
-22023-10-25 20:15:20@
#include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> #include<bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; char a[N]; int lena,lenc,a1[N],c1[N],x,b; int main(){ cin >> a >> b; lena = strlen(a); for(int i = 0;i < lena;i++) a1[i] = a[lena - i - 1] - '0'; for(int i = lena - 1;i >= 0;i--) { c1[i] = (x * 10 + a1[i]) / b; x = (x * 10 + a1[i]) % b; } lenc = lena; while(c1[lenc] == 0 && lenc > 0) lenc--; for(int i = lenc;i >= 0;i--) cout << c1[i];
return 0;
}
-
-32024-10-22 16:48:34@
little bird ,little bird
#include<iostream> using namespace std; string a; int b; const int N=1e6+532; int a1[N],lena,c1[N],lenc,yu; int main(){ cin>>a>>b; lena=a.size(); for(int i=0;i<lena;i++) { a1[i] = a[i]-'0'; } for(int i=0;i<=lena;i++) { c1[i] = (yu*10+a1[i])/b; yu = (yu*10+a1[i])%b; } while(c1[lenc]==0&&lenc <lena-1) { lenc++; } for(int i=lenc;i<=lena-1;i++) { cout<<c1[i]; } return 0; } 小鸟专属
-
-32023-4-30 11:22:19@
#include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> #include<bits/stdc++.h> using namespace std; int a[510],c[1010]; int la,b,x; string s1,s2; int main(){ cin >> s1 >> b; la=s1.size(); for (int i=0; i<la; i++){ a[i+1]=s1[i]-'0'; } for (int i=1; i<=la; i++){ c[i]=(x*10+a[i])/b; x=(x*10+a[i])%b; } int lc = 1; while(c[lc]==0&&lc<la)lc++; for (int i=lc; i<=la; i++)cout <<c[i]; return 0; }
-
-42023-1-26 12:38:02@
#include<bits/stdc++.h> using namespace std; int x[2005]; int c[2005]; int main() { string a; long long y,ans=0,l=0; cin>>a>>y; int la=a.size(),b=0; for(int i=la-1; i>=0; i=i-1)x[la-i-1]=int(a[i]-'0'); for(int i=la-1; i>=0; i=i-1) { ans=ans*10+x[i]; c[la-i-1]=ans/y; ans=ans%y; } for(int i=0; i<la; i=i+1) { if(c[i]==0)l=l+1; else break; } for(int i=l; i<la; i=i+1) { if((c[i]!=0)||(i==la-1))b=1; if(b==1)printf("%d",c[i]); } if(l>=la-1)printf("0\n"); return 0; }
- 1
信息
- ID
- 1189
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 394
- 已通过
- 139
- 上传者