fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. int main() {
  6. int t, k, a, b, c;
  7. scanf("%d", &t);
  8. while(t--) {
  9. a=103993, b=33102;
  10. scanf("%d", &k);
  11. printf("%d", a/b);
  12. c=a/b;
  13. a=(a-c*b)*10;
  14. for(int i=1; i<=k; i++) {
  15. if(i==1) printf(".");
  16. c=a/b;
  17. printf("%d", c);
  18. a=(a-c*b)*10;
  19. }
  20. printf("\n");
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 3300KB
stdin
3
0
6
20
stdout
3
3.141592
3.14159265301190260407