結果

問題 No.1486 ロボット
ユーザー tarattata1
提出日時 2021-04-23 08:26:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 1,006 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 90,832 KB
実行使用メモリ 817,480 KB
最終ジャッジ日時 2024-07-04 06:55:24
合計ジャッジ時間 3,450 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 RE * 1
other AC * 3 RE * 3 MLE * 1 -- * 10
権限があれば一括ダウンロードができます

ソースコード

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