Topic Links:
https://vijos.org/p/1010
Main Topic :
Multiple sets of data, the N power of R (R is not more than 9999.9 decimal n<=200) R is guaranteed to occupy 6 bits
does not output leading 0 and suffix 0, integers only output integral parts
Topic Ideas:
"High precision"
Directly with double is certainly not possible. After all, the accuracy requirements are so high.
This is done by first writing down the number of decimal places to be output, then amplifying the decimal to 6 bits, then processing the output after a high-precision power.
1 //2 //by Coolxxx3 //4#include <iostream>5#include <algorithm>6#include <string>7#include <iomanip>8#include <memory.h>9#include <time.h>Ten#include <stdio.h> One#include <stdlib.h> A#include <string.h> -#include <stdbool.h> -#include <math.h> the #defineMin (a) < (b) ( A):(B)) - #defineMax (a) (a) > (b)? ( A):(B)) - #defineABS (a) ((a) >0? ( A):(-(a))) - #defineLowbit (a) (a& (a)) + #defineSqr (a) (a) * (a) - #defineSwap (a) (a) ^= (b), (b) ^= (a), (a) ^= (b) + #defineEPS 1e-8 A #defineMAX 0x7f7f7f7f at #defineJ 10 - #definePI 3.1415926535897 - #defineN 1504 - using namespacestd; - intN,m,lll,ans,cas; - Chars[Ten]; in intA[n]; - voidGJDCHENGDJD () to { + inti; -a[0]+=6; the for(i=1; i<=a[0];i++) *a[i]*=ans; $ for(i=1; i<=a[0];i++)Panax Notoginseng { -a[i+1]+=a[i]/J; thea[i]%=J; + } A while(a[a[0]+1]) a[0]++; the while(!a[a[0]]) a[0]--; + } - intMain () $ { $ #ifndef Online_judge - //freopen ("1.txt", "R", stdin); - //freopen ("2.txt", "w", stdout); the #endif - inti,j,k;Wuyi while(~SCANF ("%s%d",s,&N)) the { -Memset (A,0,sizeof(a)); Wuans=0; - for(i=0;i<6; i++) About { $ if(s[i]!='.') -ans=ans*Ten+s[i]-'0'; - ElseLll=5-i; - } Alll*=N; + if(n==0) the { -Puts"1"); $ Continue; the } thea[0]=a[1]=1; the for(i=1; i<=n;i++) the GJDCHENGDJD (); - for(i=1; i<=lll;i++) in if(a[i]==0) a[i]=-1; the Else Break; the if(a[0]>lll) About { the for(i=a[0];i>lll && a[i]==0; i--); the for(; i>lll;i--) theprintf"%d", A[i]); + if(a[lll]!=-1) - { theprintf".");Bayi for(I=lll;i && a[i]!=-1; i--) theprintf"%d", A[i]); the } - } - Else the { theprintf"."); the for(i=lll;i>a[0];i--) theprintf"0"); - for(i=a[0];i && a[i]!=-1; i--) theprintf"%d", A[i]); the } thePuts"");94 } the return 0; the } the 98 About /* - //101 102 //103 */
View Code
"High precision" Vijos P1010 Emperor Qianlong's confusion