Advertisement
theo830

Untitled

Sep 14th, 2019
599
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. ios_base::sync_with_stdio(0);
  5. cin.tie(0);
  6. int t;
  7. cin>>t;
  8. while(t--){
  9. long long a,b,c;
  10. cin>>a>>b>>c;
  11. a--;
  12. c--;
  13. long long ans=0;
  14. for(long long x=1;x<=b;x++){
  15. long long theans = a*c;
  16. long long plin=0;
  17. long long k = x * x;
  18. for(long long i=1;i<=min(x,max(a,c));i++){
  19. long long z = k / i;
  20. if(i <= a)
  21. plin += min(c,z);
  22. if(i <= c){
  23. plin += min(a,z);
  24. }
  25. }
  26. plin-=min(x,a)*min(x,c);
  27. theans-=plin;
  28. theans%=1000000007;
  29. ans += theans;
  30. ans %= 1000000007;
  31. }
  32. cout<<ans<<"\n";
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement