結果
問題 | No.44 DPなすごろく |
ユーザー | YamagenSakam |
提出日時 | 2019-04-21 10:56:25 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 1,323 bytes |
コンパイル時間 | 968 ms |
コンパイル使用メモリ | 103,512 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-05 04:33:59 |
合計ジャッジ時間 | 1,795 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 3 ms
5,248 KB |
testcase_15 | AC | 1 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | AC | 2 ms
5,248 KB |
testcase_19 | AC | 2 ms
5,248 KB |
testcase_20 | AC | 2 ms
5,248 KB |
testcase_21 | AC | 2 ms
5,248 KB |
testcase_22 | AC | 2 ms
5,248 KB |
testcase_23 | AC | 2 ms
5,248 KB |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:39, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38, from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45, from main.cpp:20: In member function 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]', inlined from 'int main()' at main.cpp:58:13: /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ostream:202:25: warning: 'aN' may be used uninitialized [-Wmaybe-uninitialized] 202 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ main.cpp: In function 'int main()': main.cpp:52:8: note: 'aN' was declared here 52 | ll aN; | ^~
ソースコード
#include <stdio.h> #include <set> #include <map> #include <unordered_map> #include <unordered_set> #include <list> #include <queue> #include <stack> #include <cmath> #include <ctime> #include <cstdio> #include <vector> #include <string> #include <bitset> #include <cctype> #include <cstdlib> #include <cstring> #include <utility> #include <numeric> #include <complex> #include <sstream> #include <fstream> #include <iomanip> #include <cassert> #include <iostream> #include <iterator> #include <algorithm> #include <functional> using namespace std; typedef long long ll; const double EPS = 1e-9; typedef vector<int> vint; typedef vector<vector<int>> v2int; typedef vector<ll> vll; typedef vector<vector<ll>> v2ll; typedef list<int> liint; typedef pair<int, int> pint; const int INF = int(2e9); const ll LINF = ll(2e9) * ll(2e9); #define rep(i, n) REP(i, 0, n) #define ALL(v) v.begin(), v.end() #define MSG(a) cout << #a << " " << a << endl; #define REP(i, x, n) for(int i = x; i < n; i++) template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; } template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; } int main() { int N; cin >> N; ll a0 = 1, a1 = 1; ll aN; rep(i, N - 1) { aN = a0 + a1; a0 = a1; a1 = aN; } cout << aN << endl; return 0; }