結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー ootakakazukiootakakazuki
提出日時 2019-06-11 17:12:14
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 619 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 58,968 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 01:13:30
合計ジャッジ時間 1,647 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 2 ms
5,248 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 WA -
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 1 ms
5,376 KB
testcase_32 WA -
testcase_33 AC 2 ms
5,376 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    ll N; cin>>N;
    ll a, b, c; cin>>a>>b>>c;
    
    
    ll a_v, b_v, c_v;
    ll ab_v, bc_v, ca_v;
    
    a_v = N/a; b_v = N/b, c_v = N/c;

    ab_v = N/(a*b); bc_v = N/(b*c); ca_v = N/(c*a);
    ll abc_v = N/(a*b*c);

    if(b%a==0) {b_v = 0; ab_v = 0; bc_v = 0; abc_v = 0;}
    if(c%a==0) {c_v = 0; ca_v = 0; bc_v = 0; abc_v = 0;}
    if(c%b==0) {c_v = 0; bc_v = 0; ca_v = 0; abc_v = 0;}
    
    ll ans = a_v + b_v + c_v - ab_v - bc_v - ca_v + abc_v;
    cout<<ans<<endl;
}
0