結果
問題 | No.1686 Geschenkt |
ユーザー |
|
提出日時 | 2021-09-24 21:23:38 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 435 bytes |
コンパイル時間 | 2,383 ms |
コンパイル使用メモリ | 192,104 KB |
最終ジャッジ日時 | 2025-01-24 16:44:07 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
/** * author: ivanzuki * created: Fri Sep 24 2021 **/ #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> has(36); for (int i = 0; i < n; i++) { int a; cin >> a; ++has[a]; } int ans = 0; for (int a = 1; a < 36; a++) { if (has[a] && !has[a - 1]) { ans += a; } } cout << ans << '\n'; return 0; }