結果
問題 | No.316 もっと刺激的なFizzBuzzをください |
ユーザー |
|
提出日時 | 2015-12-09 10:36:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 755 bytes |
コンパイル時間 | 1,209 ms |
コンパイル使用メモリ | 158,536 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 11:28:26 |
合計ジャッジ時間 | 2,259 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘void RI(int&, T& ...) [with T = {int, int, int}]’: main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d",&head); | ~~~~~^~~~~~~~~~~~ main.cpp: In function ‘void RI(int&, T& ...) [with T = {int, int}]’: main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] main.cpp: In function ‘void RI(int&, T& ...) [with T = {int}]’: main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] main.cpp: In function ‘void RI(int&, T& ...) [with T = {}]’: main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
ソースコード
#include<bits/stdc++.h>#define REP(x,y,z) for(int x=y;x<=z;x++)#define FORD(x,y,z) for(int x=y;x>=z;x--)#define MSET(x,y) memset(x,y,sizeof(x))#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)#define F first#define S second#define MP make_pair#define PB push_back#define SZ size()#define Mvoid RI(){}template<typename... T>void RI( int& head, T&... tail ) {scanf("%d",&head);RI(tail...);}using namespace std;typedef long long LL;int n,a,b,c;int main(){RI(n,a,b,c);LL ans = (LL)n/a + n/b + n/c;LL x = (LL)a*b / __gcd(a,b);ans -= n/x;x = (LL)a*c / __gcd(a,c);ans -= n/x;x = (LL)b*c / __gcd(b,c);ans -= n/x;x = x*a / __gcd(x,(LL)a);ans += n/x;printf("%lld\n",ans);return 0;}