結果
| 問題 |
No.1486 ロボット
|
| コンテスト | |
| ユーザー |
zumin
|
| 提出日時 | 2021-05-01 14:47:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 552 bytes |
| コンパイル時間 | 647 ms |
| コンパイル使用メモリ | 67,840 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 22:35:32 |
| 合計ジャッジ時間 | 1,745 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <cmath>
using namespace std;
using ll=long long;
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
int main(){
ll a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
ll first=a+b,second=c+d;
ll lcm=first*second/gcd(first,second);
ll part=0;
for(ll t=0;t<lcm;t++){
if(t%first<a&&t%second<c){
part++;
}
}
ll ans=part*(e/lcm);
for(ll t=0;t<e%lcm;t++){
if(t%first<a&&t%second<c){
ans++;
}
}
cout<<ans<<endl;
return 0;
}
zumin