結果
問題 |
No.1486 ロボット
|
ユーザー |
![]() |
提出日時 | 2021-04-23 21:23:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 7,160 ms |
コンパイル使用メモリ | 249,944 KB |
最終ジャッジ日時 | 2025-01-20 23:30:06 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#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; }