結果
問題 | No.1486 ロボット |
ユーザー |
👑 ![]() |
提出日時 | 2021-04-23 22:13:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 447 bytes |
コンパイル時間 | 664 ms |
コンパイル使用メモリ | 66,440 KB |
最終ジャッジ日時 | 2025-01-20 23:58:39 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | int A,B,C,D; scanf("%d%d%d%d",&A,&B,&C,&D); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:8:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | int E; scanf("%d",&E); | ~~~~~^~~~~~~~~
ソースコード
#include <iostream> using namespace std; using ll = long long; #define rep(i,n) for(int i=0; i<(n); i++) int main(){ int A,B,C,D; scanf("%d%d%d%d",&A,&B,&C,&D); int E; scanf("%d",&E); int cy = (A+B)*(C+D); int cyans = 0; int ans = 0; rep(t,cy){ int tmp = 1; if(t%(A+B) >= A) tmp = 0; if(t%(C+D) >= C) tmp = 0; cyans += tmp; if(E%cy > t) ans += tmp; } ans += cyans * (E/cy); printf("%d\n",ans); return 0; }