結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
|
提出日時 | 2016-11-25 15:23:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 927 ms / 1,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 459 ms |
コンパイル使用メモリ | 63,344 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-27 11:14:04 |
合計ジャッジ時間 | 2,437 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
#include <iostream>using namespace std;int main() {int n, a, b, c; cin >> n >> a >> b >> c;if (a == 1 or b == 1 or c == 1) {cout << n << endl;return 0;}int i = n % a, j = n % b, k = n % c;int ans = 0;while (true) {int d = min(i, min(j, k));i -= d; if (i == 0) i = a;j -= d; if (j == 0) j = b;k -= d; if (k == 0) k = c;n -= d; if (n <= 0) break;++ ans;}cout << ans << endl;return 0;}