fork(6) download
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. // WYNIK dla maksa z zadania 36963 = 4292242973 czas okolo 60 sek
  5. int t,r;
  6. float dist;
  7. int main()
  8. {
  9. cin>>t;
  10. for( int a=0;a<=t-1;a++)
  11. {
  12. cin>>r;
  13. long long points=0;
  14. for (int b=1;b<=r;b++)
  15. {
  16. for (int c=0;c<=r;c++)
  17. {
  18. // jesli X + Y sa w sumie mniejsze lub rowne niz PROMIEN R automatycznie dodaje 1 PKT
  19. if (c+b<=r) points++;
  20. else
  21. {
  22. dist=((b*b)+(c*c));
  23. dist=sqrt(dist);
  24. if (dist<=r) points++;
  25. // jesli dystans przekrocxzyl R to juz dalej nie licze
  26. else c=r;
  27. }
  28. }
  29. }
  30. points=(points*4)+1;
  31. cout<<points<<endl;
  32. }
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
Standard output is empty