結果
| 問題 | No.42 貯金箱の溜息 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-13 12:49:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2,271 ms / 5,000 ms |
| コード長 | 1,631 bytes |
| 記録 | |
| コンパイル時間 | 1,113 ms |
| コンパイル使用メモリ | 87,504 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 21:03:59 |
| 合計ジャッジ時間 | 6,961 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 |
コンパイルメッセージ
main.cpp: In function ‘int in()’:
main.cpp:33:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
33 | int in() { int x; scanf("%d", &x); return x; }
| ~~~~~^~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:44:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
44 | scanf("%lld", &M);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef unsigned uint;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair
template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T &t, const T &f) { if (t > f) t = f; }
template<typename T> void chmax(T &t, const T &f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }
const Int MO = 1000000009;
Int M;
Int dp[2048];
int main() {
for (int TC = in(); TC--; ) {
scanf("%lld", &M);
memset(dp, 0, 667 << 3);
dp[0] = 1;
for (int l = 0; 1LL << l <= M; ++l) {
memset(dp + 667, 0, 667 << 3);
for (int x = 666 + 1; x >= 1; --x) dp[x] += dp[x - 1];
for (int x = 666 + 6; x >= 5; --x) dp[x] += dp[x - 5];
for (int x = 666 + 16; x >= 10; --x) dp[x] += dp[x - 10];
for (int x = 666 + 66; x >= 50; --x) dp[x] += dp[x - 50];
for (int x = 666 + 166; x >= 100; --x) dp[x] += dp[x - 100];
for (int x = 666 + 666; x >= 500; --x) dp[x] += dp[x - 500];
for (int x = 0; x <= 666; ++x) {
dp[x] = dp[x << 1 | (M >> l & 1)] % MO;
}
}
printf("%lld\n", dp[0]);
}
return 0;
}