結果
| 問題 |
No.637 X: Yet Another FizzBuzz Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-09 23:43:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 1,000 ms |
| コード長 | 632 bytes |
| コンパイル時間 | 2,858 ms |
| コンパイル使用メモリ | 197,204 KB |
| 最終ジャッジ日時 | 2025-01-14 09:01:39 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;
void input(vector<int> &v) {
string src, str;
getline(cin, src);
stringstream ss{src};
while (getline(ss, str, ' ')) v.emplace_back(stoi(str));
}
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() {
vector<int> v;
input(v);
int ans = 0;
rep(i, 0, v.size()) ans += anotherFizzBuzz(v[i]);
cout << ans << endl;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
}