結果

問題 No.1486 ロボット
ユーザー 👑 Nachia
提出日時 2021-04-23 22:12:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 65,664 KB
最終ジャッジ日時 2025-01-20 23:58:36
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
      |          ~~~~~^~~~~~~~~

ソースコード

diff #

#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;
}
0