提出 #5346281


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
#define step(i, s, n, d) for(int i=s; i<n; i+=d)
#define FOR(i,s,n) step(i,s,n,1)
#define rep(i,n) FOR(i,0,n)
#define ll long long
typedef pair<int, int> P;

int main(){
  int r, b, g, n, ans = 0;
  cin >> r >> b >> g >> n;
  rep(i, n+1) {
    rep(j, n+1) {
      int gnum = n-((r*i) + (b*j));
      if (gnum % g == 0 && gnum >= 0) {
        ans += 1;
        // cout << i*r << " " << j*b << " " << gnum%g << endl;
      }
    }
  }
  cout << ans << endl;
}

提出情報

提出日時
問題 B - RGB Boxes
ユーザ KeitaKishida0811
言語 C++14 (GCC 5.4.1)
得点 200
コード長 525 Byte
結果 AC
実行時間 31 ms
メモリ 256 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 11
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All rand_01.txt, rand_02.txt, rand_03.txt, rand_04.txt, rand_05.txt, rand_06.txt, rand_07.txt, rand_08.txt, rand_09.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
rand_01.txt AC 4 ms 256 KiB
rand_02.txt AC 28 ms 256 KiB
rand_03.txt AC 3 ms 256 KiB
rand_04.txt AC 23 ms 256 KiB
rand_05.txt AC 19 ms 256 KiB
rand_06.txt AC 21 ms 256 KiB
rand_07.txt AC 24 ms 256 KiB
rand_08.txt AC 30 ms 256 KiB
rand_09.txt AC 30 ms 256 KiB
sample_01.txt AC 1 ms 256 KiB
sample_02.txt AC 31 ms 256 KiB