結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
![]() |
提出日時 | 2018-01-27 21:13:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 816 bytes |
コンパイル時間 | 1,423 ms |
コンパイル使用メモリ | 158,836 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-29 07:06:05 |
合計ジャッジ時間 | 6,841 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 33 |
コンパイルメッセージ
main.cpp: In function ‘ll gcd(int, int)’: main.cpp:27:12: warning: control reaches end of non-void function [-Wreturn-type] 27 | gcd(b, a % b); | ~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h>#include <iostream>#include <iomanip>#include <vector>#include <algorithm>#include <string>#include <sstream>#include <cmath>#include <stack>#include <queue>#include <cctype>#include <stdio.h>#include <map>#include <string.h>#include <utility>typedef long long ll;using namespace std;typedef pair<int, int> P;ll gcd(int a, int b) {if (b == 0) {return a;}gcd(b, a % b);}ll lcm(int a, int b) {return a / gcd(a, b) * b;}int main() {ll n = 0;int anum, bnum, cnum;cin >> n >> anum >> bnum >> cnum;ll a = n / anum;ll b = n / bnum;ll c = n / cnum;ll ab = n / lcm(anum, bnum);ll bc = n / lcm(bnum, cnum);ll ca = n / lcm(cnum, anum);ll abc = n / lcm(anum, lcm(bnum, cnum));cout << a + b + c - ab - bc - ca + abc << endl;return 0;}