結果

問題 No.1486 ロボット
ユーザー 沙耶花沙耶花
提出日時 2021-04-23 21:23:19
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 4,398 ms
コンパイル使用メモリ 258,420 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 11:34:44
合計ジャッジ時間 5,429 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

int main(){
	
	int A,B,C,D;
	cin>>A>>B>>C>>D;
	
	vector<bool> f0((A+B)*(C+D),false),f1((A+B)*(C+D),false);
	
	rep(i,f0.size()){
		if(i%(A+B)<A)f0[i] = true;
	}
	rep(i,f1.size()){
		if(i%(C+D)<C)f1[i] = true;
	}
	
	int E;
	cin>>E;
	
	int sum = 0;
	int ans = 0;
	rep(i,f0.size()){
		if(f0[i]&&f1[i])sum++;
	}
	
	ans += (E/((A+B)*(C+D))) * sum;
	E %= ((A+B)*(C+D));
	
	rep(i,E){
		if(f0[i]&&f1[i])ans++;
	}
	
	cout<<ans<<endl;
	
	
    return 0;
}
0