1 solutions
-
0
C++ :
#include <bits/stdc++.h> #define N 35000 using namespace std; int dp[5][N]; void solve(){ int n; cin >> n; int ans = 0; for (int i = 1;i<=4;i++) ans += dp[i][n]; cout << ans << endl; } int main(){ dp[0][0] = 1; for (int i = 1;i*i <=N - 1;i++){ for (int k = 1;k<=4;k++){ for (int j = N -1;j>=i*i;j--){ dp[k][j] += dp[k-1][j-i*i]; } } } int t; cin >> t; while(t--) solve(); return 0; }
- 1
Information
- ID
- 114
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By