爆0,玄关(c高精)

P1480 A/B Problem

zengmingheng666 @ 2025-01-04 11:50:05

#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+100;
string s1,s2;
short l1,l2,l3,a[N],b,c[N],ans;
int main(){
    cin>>s1>>b;
    l1=s1.size();l2=s2.size();
    l3=l1+l2+1;
    for(int i=0;i<l1;i++){
        ans=ans*10+a[i];
        c[i]=ans/b;
        ans%=b;
    }

    for(int i=l3;i>=1;i--)cout<<c[i];
}

帮调一下可以吗,

代码发到评论区

故意写的大大的


by syy7788 @ 2025-01-05 09:58:47

#include<bits/stdc++.h>
using namespace std;
char a1[20001];
long long b,c[20001],d,a[20001],len,lenc;
int main ()
{
    cin>>a1>>b;
    len=strlen(a1);
    for(int i=1;i<=len;i++)a[i]=a1[i-1]-48;
    for(int i=1;i<=len;++i)
    {
        c[i]=(d*10+a[i])/b;
        d=(d*10+a[i])%b;
    }
    lenc=1;
    while(c[lenc]==0&&lenc<len)lenc++;
    for(int i=lenc;i<=len;++i)cout<<c[i];
    return 0;
}

|