結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー schemelisp
提出日時 2015-12-15 12:07:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 513 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 54,456 KB
実行使用メモリ 16,952 KB
最終ジャッジ日時 2024-09-15 13:02:03
合計ジャッジ時間 4,984 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other TLE * 1 -- * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

using ull = unsigned long long int;

bool judge(ull, ull, ull, ull);
ull sum(ull, ull, ull, ull);

int main()
{
	ull n, a, b, c;
	cin >> n;
	cin >> a >> b >> c;
	std::cout << sum(n, a, b, c) << std::endl;

	return 0;
}

bool judge(ull num, ull a, ull b, ull c){
	return !(num%a) || !(num%b) || !(num%c);
}

ull sum(ull n, ull a, ull b, ull c){
	ull current = 1,
		ans = 0;
	
	while(current <= n){
		if(judge(current,a,b,c)){
			ans++;
		}
		current++;
	}
	return ans;
}
0