結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー dgd1724
提出日時 2018-07-21 20:24:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 485 bytes
コンパイル時間 666 ms
コンパイル使用メモリ 65,940 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 05:01:07
合計ジャッジ時間 1,664 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <fstream>
#include <iostream>
#include <vector>
#include <cmath>

int main() {

	//std::ifstream inf("Text.txt");	std::cin.rdbuf(inf.rdbuf());
	int ans = 0;

	std::vector<int> a(5);
	for (int i = 0; i < 5; i++) {
		std::cin >> a[i];
		if (a[i] % 15 == 0) {
			ans += 8;
		}
		else if (a[i] % 5 == 0) {
			ans += 4;
		}
		else if (a[i] % 3 == 0) {
			ans += 4;
		}
		else {
			ans += static_cast<int>(std::log10(a[i]) + 1);
		}
	}

	std::cout << ans << std::endl;

	return 0;
}
0