Advertisement
tepyotin2

Bathroom Tiles 3/10

Dec 9th, 2023
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     ios_base::sync_with_stdio(0), cin.tie(0);
  7.     // freopen("tiles.in", "r", stdin);
  8.     int n;
  9.     cin >> n;
  10.     int ans = 0;
  11.     for(int a=0; a<n; a++){
  12.         for(int b=0; b<n; b++){
  13.             for(int c=0; c<n; c++){
  14.                 int d = sqrt(n-((a*a)+(b*b)+(c*c)));
  15.                 if((a*a)+(b*b)+(c*c)+(d*d) == n){
  16.                     ans++;
  17.                 }
  18.             }
  19.         }
  20.     }
  21.     cout << ans << '\n';
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement