結果

問題 No.786 京都大学の過去問
ユーザー トミー
提出日時 2024-11-25 01:06:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 1,849 ms
コンパイル使用メモリ 194,388 KB
最終ジャッジ日時 2025-02-25 06:10:34
ジャッジサーバーID
(参考情報)
judge2 / judge2
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:28: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 | int main() { solve();system("pause"); }
      |                      ~~~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;


void solve() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin>>n;
  vector<ll> dp(n+1);
  dp.at(0)=1;
  dp.at(1)=1;
  for(ll i=2;i<=n;i++){
    dp.at(i)=dp.at(i-1)+dp.at(i-2);
  }
  cout<<dp.at(n)<<endl;
} 

int main() { solve();system("pause"); }
0