結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
![]() |
提出日時 | 2017-11-16 01:47:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 882 bytes |
コンパイル時間 | 507 ms |
コンパイル使用メモリ | 79,096 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 04:18:03 |
合計ジャッジ時間 | 6,231 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 4 |
other | RE * 33 |
コンパイルメッセージ
main.cpp: In function ‘long long int gcd(long long int, long long int)’: main.cpp:22:8: warning: control reaches end of non-void function [-Wreturn-type] 22 | gcd( b, a%b ); | ~~~^~~~~~~~~~
ソースコード
#include <iostream> #include <vector> #include <string> #include <cstring> #include <math.h> #include <cmath> #include <limits.h> #include <map> #include <set> #include <queue> #include <algorithm> #include <functional> #include <stdio.h> using namespace std; long long MOD = 1000000007; long long gcd( long long a, long long b ) { if ( b == 0 ) { return a; } gcd( b, a%b ); } int main() { long long N; int a,b,c; cin >> N >> a >> b >> c; long long A = N/a; long long B = N/b; long long C = N/c; long long AB = N / (a * b / gcd(a,b)); long long BC = N / (b * c / gcd(b,c)); long long CA = N / (c * a / gcd(c,a)); long long x = a * b / gcd(a,b); long long y = b * c / gcd(b,c); long long ABC = N / (x * y / gcd(x,y)); cout << A+B+C-(AB+BC+CA)+ABC << endl; return 0; }