fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int t;
  6. scanf("%d",&t);
  7. while(t--)
  8. {
  9. int k ;
  10. printf("3");
  11. scanf("%d",&k);
  12. if(k>0)
  13. printf(".");
  14. long long int num=30;
  15. long long int numer = 1039930;
  16. long long int denom = 33102;
  17. while(k--)
  18. {
  19. long long int bro = numer/denom;
  20. printf("%lld",bro-num);
  21. num=bro;
  22. num*=10;
  23. numer*=10;
  24. }
  25. printf("\n");
  26. }
  27. return 0;
  28. }
  29.  
Success #stdin #stdout 0s 2172KB
stdin
3
0
6
20
stdout
3
3.141592
3.1415926530119-55726977444594122290790977837652229079097783758-22290790977837581671809323337815-27863488722297001671809323337815