結果
問題 | No.1486 ロボット |
ユーザー |
|
提出日時 | 2021-04-24 03:16:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 378 bytes |
コンパイル時間 | 452 ms |
コンパイル使用メモリ | 63,872 KB |
実行使用メモリ | 7,356 KB |
最終ジャッジ日時 | 2024-07-04 08:55:12 |
合計ジャッジ時間 | 1,174 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 5 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int A,B,C,D,E; int c[1000000]; main() { cin>>A>>B>>C>>D>>E; for(int i=0;i<C+D;i++) { for(int j=0;j<A;j++)c[i*(A+B)+j]++; } for(int i=0;i<A+B;i++) { for(int j=0;j<C;j++)c[i*(C+D)+j]++; } int t=(A+B)*(C+D); int s=0; for(int i=0;i<t;i++)s+=c[i]==2; int ans=E/t*s; E%=t; for(int i=0;i<E;i++)ans+=c[i]==2; cout<<ans<<endl; }