求救

P2818 天使的起誓

这个就是高精除以低精吧?
by ImposterAnYu @ 2021-05-06 21:52:03


```cpp #include<bits/stdc++.h> using namespace std; char aa[25]; int a[25],b,c[25],sa,sc = 1,i,x; int main(){ cin >> b; cin >> aa; sa = strlen(aa); for(i = 0; i < sa; i++){ a[i + 1] = aa[i] - 48; } for(i = 1; i <= sa; i++){ c[i] = (x * 10 + a[i]) / b; x = (x * 10 + a[i]) % b; } while(!c[sc] && sc < sa) sc++; for(i = sc; i <= sa; i++){ cout<< c[i] ; } return 0; } ``` 刚写的代码,我也不知道能不能AC
by ImposterAnYu @ 2021-05-06 22:06:24


@[ImopsterAnYu](/user/510555) 谢,高精度模运算就是本题原意,可是我测试数据下载下来后试了下.发现~~我的秒出还对~~( 但偏偏提上去是错的
by 剑雪清寒 @ 2021-05-11 20:28:49


```cpp #include<bits/stdc++.h> using namespace std; char s[100000010]; long long a[100000010],b,c[100000010]; int main() { int la,lc; cin>>b>>s; lc=la=strlen(s); for(long long i=1;i<=la;i++) a[i]=s[la-i]-'0'; int d,r=0; for(long long i=la;i>=1;i--) { d=r*10+a[i]; r=d%b; } if(r!=0) cout<<r; else cout<<b; return 0; } ```
by mayue123 @ 2021-11-19 20:56:26


@[剑雪清寒](/user/214728)
by mayue123 @ 2021-11-19 20:56:41


@[mayue123](/user/491101) 早过了,您为什么考古呢。。。不过谢谢
by 剑雪清寒 @ 2021-11-21 20:15:39


@[剑雪清寒](/user/214728) ~~忘了看时间~~
by mayue123 @ 2021-11-26 16:34:25


|