fork(3) download
  1. #include <iostream>
  2. #include <math.h>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int testy;
  10. cin>>testy;
  11. for (int i=0; i<testy; i++)
  12. {
  13. unsigned int osoby,ciec;
  14. long double srednica,cm;
  15. int dzielnik=2;
  16. cin>>srednica>>osoby;
  17. cm=(((srednica*M_PI)/osoby));
  18. if (fmod (osoby,dzielnik)==0)
  19. {
  20. ciec=(osoby/2);
  21. cout<<fixed<<setprecision(3)<<cm<<" "<<ciec<<endl;
  22. }
  23. else
  24. {
  25. ciec=osoby;
  26. cout<<fixed<<setprecision(3)<<cm<<" "<<ciec<<endl;
  27. }
  28. }
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 16056KB
stdin
3
10 4
5 2
1213123 3
stdout
7.854 2
7.854 1
1270379.435 3