版本比较
题解 P1940 Reversible Number
正文
增加 6 行删除 6 行
134 行未改动全部展开13513613713813913914014114214214314414514614514614714814915020 行未改动1711721731741751751761771781791801811821821831841851863 行未改动134 行未改动全部展开using namespace std;const int N=400+20;struct BigInt { int a[N], len; inline void carry() { //进位,顺便更新 len inline void carry() { //进位,顺便更新 len for(int i=0; i<len; i++) { a[i+1]+=a[i]/10, a[i]%=10; if(a[len]) ++len; //更新 len if(a[len]) ++len; //更新 len } } BigInt operator = (int i2) { //将低精赋值给高精 for(int i=1; i<=N-3; i++) a[i]=0; //清零 BigInt operator = (int i2) { //将低精赋值给高精 for(int i=1; i<=N-3; i++) a[i]=0; //清零 len=1, a[0]=i2, carry(); } BigInt operator * (int i2) { //高精乘低精 BigInt ret=*this;20 行未改动 for(int i=1; i<=x; i++) { //从 1 到 x 都要计算 if(i%2==0) { //f(n)%2==0 BigInt dl; dl=20; for(int t=1; t<=(i-2)/2; t++) dl=dl*30; //(i-2)/2 次幂 for(int t=1; t<=(i-2)/2; t++) dl=dl*30; //(i-2)/2 次幂 ans=ans+dl; } else if(i%4==3) { //f(n)%4==3 BigInt dl; dl=20*5; for(int t=1; t<=(i-3)/4; t++) dl=dl*(20*25); //(i-3)/4 次幂 ans=ans+dl; } } } ans.output(); return 0;}3 行未改动