結果

問題 No.1486 ロボット
ユーザー tarattata1tarattata1
提出日時 2021-04-23 08:26:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,006 bytes
コンパイル時間 1,878 ms
コンパイル使用メモリ 90,588 KB
実行使用メモリ 814,576 KB
最終ジャッジ日時 2023-09-17 10:47:55
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 RE -
testcase_08 AC 2 ms
4,376 KB
testcase_09 MLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <ctime>
#pragma warning(disable:4996) 

using namespace std;

int calc(int a, int b, int c, int d, int e)
{
    vector<int> f(e);
    int a2 = a+b, c2=c+d;
    int cnt = 0;
    int i;
    for(i=0;i<a;i++){
        int curr=i;
        while(curr<e) {
            f[curr]++;
            curr+=a2;
        }
    }
    for(i=0;i<c;i++){
        int curr=i;
        while(curr<e) {
            f[curr]++;
            curr+=c2;
        }
    }
    for (i = 0; i < e; i++) {
        if (f[i]==2) {
            cnt++;
        }
    }
    return cnt;
}

int main()
{
    int a, b, c, d, e;
    scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);

    int ans = calc(a, b, c, d, e);
    printf("%d\n", ans);

    return 0;
}

0