結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー #leucobird
提出日時 2021-03-16 10:13:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 572 bytes
コンパイル時間 1,653 ms
コンパイル使用メモリ 166,416 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 20:55:32
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)

int main(void)
{
  const int n = 5;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int cnt = 0;
  rep(i, n)
  {
    if (a[i] % 15 == 0)
      cnt += 8;
    else if (a[i] % 3 == 0 && a[i] % 5 != 0)
      cnt += 4;
    else if (a[i] % 5 == 0 && a[i] % 3 != 0)
      cnt += 4;
    else
    {
      if (1 <= a[i] && a[i] <= 9)
        cnt += 1;
      else if (10 <= a[i] && a[i] <= 99)
        cnt += 2;
      else
        cnt += 3;
    }
  }

  cout << cnt << endl;
  return 0;
}
0