Got to 4 o'clock in the morning a not out, to GG.
A. Golden System Http://codeforces.com/contest/458/problem/A
1#include <cstdio>2#include <cstring>3#include <cmath>4#include <algorithm>5 using namespacestd;6 Const DoubleQ= (sqrt (5.0)+1)/2;7 Const intm=100010;8 CharA[m],b[m];9 intSa[m],sb[m];Ten voidGxrev (Charc[]) { One for(intI=0, J=strlen (c)-1; i<j;i++,j--){ A swap (c[i],c[j]); - } - } the DoubleGxpow (DoubleXintp) { - Doubleres=1; - while(p) { - if(p&1) res*=x; +x*=x; -p>>=1; + } A returnRes; at } - intMain () { - while(~SCANF ("%s%s", B)) { - Gxrev (a); - Gxrev (b); - intLa=strlen (a); in intlb=strlen (b); - intlen=Max (la,lb); to for(inti=la;i<len;i++) a[i]='0'; + for(inti=lb;i<len;i++) b[i]='0'; -a[len]=b[len]=0; the for(intI=0; i<len;i++){ *sa[i]=a[i]-'0'; $sb[i]=b[i]-'0';Panax Notoginseng } - for(intI=0; i<len;i++){ the if(i+2<Len) { + if(sa[i]&&sa[i+1]){ A intSma=min (sa[i],sa[i+1]); thesa[i]-=SMA; +sa[i+1]-=SMA; -sa[i+2]+=SMA; $ } $ if(sb[i]&&sb[i+1]){ - intSma=min (sb[i],sb[i+1]); -sb[i]-=SMA; thesb[i+1]-=SMA; -sb[i+2]+=SMA;Wuyi } the } - } Wu intflag=0; - for(inti=len-1; i>=0; i--){ About intSma=min (sa[i],sb[i]); $sa[i]-=SMA; -sb[i]-=SMA; - if(I-2>=0){ - if(Sa[i]) { A if(sa[i]>M) { +flag=1; the Break; - } $sa[i-1]+=Sa[i]; thesa[i-2]+=Sa[i]; thesa[i]=0; the } the if(Sb[i]) { - if(sb[i]>M) { inflag=-1; the Break; the } Aboutsb[i-1]+=Sb[i]; thesb[i-2]+=Sb[i]; thesb[i]=0; the } + } - } the if(flag==1){BayiPuts">"); the Continue; the } - if(flag==-1){ -Puts"<"); the Continue; the } the DoubleSuma=0, sumb=0; the for(intI=0;i<len&&i<3; i++){ -Suma+=gxpow (q,i) *Sa[i]; theSumb+=gxpow (q,i) *Sb[i]; the } the if(Suma>sumb) puts (">");94 Else if(Suma<sumb) puts ("<"); the ElsePuts"="); the } the return 0;98}
View Code
End