結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー test
提出日時 2020-09-10 00:02:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 465 bytes
コンパイル時間 2,134 ms
コンパイル使用メモリ 192,324 KB
最終ジャッジ日時 2025-01-14 09:01:49
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int anotherFizzBuzz(int x) {
  if (x % 15 == 0) return 8;
  if (x % 3 == 0 and x % 5 != 0) return 4;
  if (x % 3 != 0 and x % 5 == 0) return 4;
  return log10(x) + 1;
}

void solve() {
  int x, ans = 0;
  rep(i, 0, 5) {
    cin >> x;
    ans += anotherFizzBuzz(x);
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}
0