結果

問題 No.41 貯金箱の溜息(EASY)
ユーザー しらっ亭しらっ亭
提出日時 2016-03-15 19:02:22
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 1,039 bytes
コンパイル時間 1,426 ms
コンパイル使用メモリ 160,012 KB
実行使用メモリ 7,260 KB
最終ジャッジ日時 2024-04-08 13:23:06
合計ジャッジ時間 1,955 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
7,260 KB
testcase_01 AC 24 ms
7,260 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void Main()’:
main.cpp:25:25: warning: iteration 100000 invokes undefined behavior [-Waggressive-loop-optimizations]
   25 |   REP(j, MAX+1) dp[0][j]=1;
      |                 ~~~~~~~~^~
main.cpp:9:36: note: within this loop
    9 | #define REP(i,n) for (int i = 0; i < (n); i++)
      |                                    ^
main.cpp:25:3: note: in expansion of macro ‘REP’
   25 |   REP(j, MAX+1) dp[0][j]=1;
      |   ^~~
main.cpp:29:27: warning: iteration 100000 invokes undefined behavior [-Waggressive-loop-optimizations]
   29 |       dp[i][j] = dp[i-1][j];
      |                  ~~~~~~~~~^
main.cpp:7:40: note: within this loop
    7 | #define FOR(i,a,b) for (int i = (a); i < (b); i++)
      |                                        ^
main.cpp:28:5: note: in expansion of macro ‘FOR’
   28 |     FOR(j, 0, MAX+1) {
      |     ^~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FORR(x,arr) for(auto&& x:arr)
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i,n) for (int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
typedef long long ll;
// -------------------------------------

#define MAX 100000

const long long mod = 1000000009;
int dp[10][MAX];

void Main() {
  REP(j, MAX+1) dp[0][j]=1;

  FOR(i, 1, 10) {
    FOR(j, 0, MAX+1) {
      dp[i][j] = dp[i-1][j];
      if (j>=i) (dp[i][j] += dp[i][j-i]) %= mod;
    }
  }

  int T;
  cin >> T;
  REP(i, T) {
    ll m;
    cin >> m;
    ll x = m / 111111;
    cout << dp[9][x] << endl;
  }
}

int main() {Main(); return 0; }
0