結果
問題 |
No.954 Result
|
ユーザー |
![]() |
提出日時 | 2019-12-17 00:05:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 1,456 ms |
コンパイル使用メモリ | 169,800 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 12:32:58 |
合計ジャッジ時間 | 2,431 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 7 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; using lint = long long int; template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; } int main() { vector<lint> A(5); cin >> A; reverse(A.begin(), A.end()); A.push_back(-1); lint n = 1, prv = 0; if (A[0] == 1 and A[1] == 2) prv = 1; while (n < A[0]) { prv += n; swap(n, prv); } int t = 0; while (A[t] == n) { t++; prv += n; swap(n, prv); } cout << t << endl; }