結果
問題 | No.3054 ほぼ直角二等辺三角形 |
ユーザー | heno239 |
提出日時 | 2019-04-01 22:28:27 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 2,117 bytes |
コンパイル時間 | 1,094 ms |
コンパイル使用メモリ | 113,576 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-18 01:38:51 |
合計ジャッジ時間 | 2,318 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 2 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 2 ms
4,376 KB |
testcase_14 | AC | 2 ms
4,380 KB |
testcase_15 | AC | 2 ms
4,376 KB |
testcase_16 | AC | 1 ms
4,376 KB |
testcase_17 | AC | 1 ms
4,380 KB |
ソースコード
#include<iostream> #include<string> #include<cstdio> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> #include<complex> #include<bitset> #include<stack> #include<unordered_map> #include<utility> using namespace std; typedef unsigned long long ll; typedef unsigned int ui; const ll mod = 1000000007; typedef long double ld; const ll INF = 1e+14; typedef pair<int, int> P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i<n;i++) #define per(i,n) for(int i=n-1;i>=0;i--) #define Rep(i,sta,n) for(int i=sta;i<n;i++) #define rep1(i,n) for(int i=1;i<=n;i++) #define per1(i,n) for(int i=n;i>=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef complex<ld> Point; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair<ld, ld> LDP; typedef pair<ll, ll> LP; #define fr first #define sc second const int mn = 30; ll pas[mn][mn]; struct out { ll x, y, z; }; out ans[19]; void solve() { rep(i, mn) { rep(j, mn) { if (i == 0 || j == 0)pas[i][j] = 1; else pas[i][j] = (pas[i - 1][j] + pas[i][j - 1]); } } for (int i = 1; i < mn-6; i += 2) { ll k = 0, n = 0; ll s = 1; for (int j = 0; j <= i; j += 2) { k += s * pas[i-j][j]; s *= 2; } s = 1; for (int j = 1; j <= i; j += 2) { n += s * pas[i-j][j]; s *= 2; } ll m = n + k; out u = { m * m - n * n,2 * n*m ,m * m + n * n }; string xx = to_string(u.z); int len = xx.length(); ans[len] = u; } for (int i = 1; i < mn-18; i ++) { ll k = 0, n = 0; ll z = 1; vector<ll> st; rep(j, i)z *= 3; st.push_back(z); rep1(j, i) { z /= 3; z *= 2; st.push_back(z); if (j % 2)z *= 2; } rep(j, i + 1) { if (j % 2 == 0) { k += pas[i - j][j] * st[j]; } else { n += pas[i - j][j] * st[j]; } } ll m = n + k; out u = { 2*n*m,m * m - n * n ,m * m + n * n }; string xx = to_string(u.z); int len = xx.length(); ans[len] = u; } int x; cin >> x; cout << ans[x].x << " " << ans[x].y << " " << ans[x].z << endl; } int main() { solve(); //stop return 0; }