Skip to content

Commit

Permalink
Add 31000.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiyabye committed Jun 17, 2024
1 parent f38cb04 commit 86faf32
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions 31xxx/31000.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <iostream>
using namespace std;

void solve(void) {
int n; cin >> n;

int ans = (2*n+1)*(2*n+1);
for (int a=-n; a<=n; a++) {
if (a == 0) continue;
for (int b=-n; b<=n; b++) {
if (-n <= 1-a-b && 1-a-b <= n) ans++;
}
}
cout << ans;
}

int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);

solve();
return 0;
}

0 comments on commit 86faf32

Please sign in to comment.