Yideer2 @ 2024-11-23 11:29:00
#include <stdio.h>
#include<string.h>
char l1[10005];
char b[10005];
char c[10005];
long long int a;int x;
//b/a=c
int main()
{
scanf("%s",l1);
scanf("%lld",&a);
if(l1[0]=='0') printf("0");
//printf("%lld %s",a,l1);
int i;
int lb=strlen(l1);
for(i=1;i<=lb;i++){
b[i]=l1[i-1]-'0';
}
for(i=1;i<=lb;i++){
c[i]=(x*10+b[i])/a;
x=(x*10+b[i])%a;
//printf("%ld ",c[i]);
}
int lc=1;
for(lc=1;c[lc]==0;lc++);
//printf("%d ",lc);
for(i=lc;i<=lb;i++){
printf("%d",c[i]);
}
return 0;
}
by leo_liaocr @ 2024-11-23 11:36:41
@Yideer2 x的类型改long long
by Yideer2 @ 2024-11-23 11:45:32
@leo_liaocr 还是不行
by leo_liaocr @ 2024-11-23 11:47:09
@Yideer2 c数组改int
by Yideer2 @ 2024-11-23 11:48:54
@leo_liaocr 哎,还是不行
by leo_liaocr @ 2024-11-23 12:23:55
@Yideer2 ? 我试了可以啊 你看看
#include <stdio.h>
#include<string.h>
char l1[10005];
char b[10005];
int c[10005];
long long int a;long long x;
//b/a=c
int main()
{
scanf("%s",l1);
scanf("%lld",&a);
if(l1[0]=='0') printf("0");
//printf("%lld %s",a,l1);
int i;
int lb=strlen(l1);
for(i=1;i<=lb;i++){
b[i]=l1[i-1]-'0';
}
for(i=1;i<=lb;i++){
c[i]=(x*10+b[i])/a;
x=(x*10+b[i])%a;
//printf("%ld ",c[i]);
}
int lc=1;
for(lc=1;c[lc]==0;lc++);
//printf("%d ",lc);
for(i=lc;i<=lb;i++){
printf("%d",c[i]);
}
return 0;
}
by Yideer2 @ 2024-11-23 12:27:17
@leo_liaocr我的问题,确实可以,谢谢了