結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
![]() |
提出日時 | 2018-03-14 00:20:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 361 ms |
コンパイル使用メモリ | 54,868 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-24 11:58:00 |
合計ジャッジ時間 | 5,134 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 33 |
コンパイルメッセージ
main.cpp: In function ‘long long int gcd(long long int, long long int)’: main.cpp:5:13: warning: control reaches end of non-void function [-Wreturn-type] 5 | else gcd(b,a%b); | ~~~^~~~~~~
ソースコード
#include<iostream>using namespace std;long long gcd(long long a,long long b){if(b == 0) return a;else gcd(b,a%b);}long long lcm(long long a,long long b){return a*b/gcd(a,b);}int main(){int N;long long a,b,c;long long ab,bc,ca;long long abc;long long ans = 0;cin >> N;cin >> a >> b >> c;ab = lcm(a,b);bc = lcm(b,c);ca = lcm(c,a);abc = lcm(ab,c);ans += N/a + N/b + N/c;ans -= N/(ab) + N/(bc) + N/(ca);ans += N/(abc);cout << ans << endl;return 0;}