結果
問題 | No.237 作図可能性 |
ユーザー |
![]() |
提出日時 | 2015-09-10 18:48:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 955 bytes |
コンパイル時間 | 1,266 ms |
コンパイル使用メモリ | 164,436 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 05:13:16 |
合計ジャッジ時間 | 2,297 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:53:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wformat=] 53 | printf("%d\n", v.size()); | ~^ ~~~~~~~~ | | | | int std::vector<long long int>::size_type {aka long unsigned int} | %ld main.cpp:36:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 36 | scanf("%lld", &a); | ~~~~~^~~~~~~~~~~~
ソースコード
// BCC /* #include <cstdio> #include <algorithm> #include <iostream> #include <utility> #include <vector> #include <queue> */ // GCC #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; i--) #define each(i, c) for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define chmin(a, b) a = min(a, b) #define chmax(a, b) a = max(a, b) #define pb push_back #define mp make_pair typedef long long ll; const int INF = 1 << 28; const ll INFLL = 1ll << 56; int main() { vector<ll> table = {3, 5, 17, 257, 65537}; vector<ll> v; ll a; scanf("%lld", &a); for (ll x = 1; x <= (ll)1e9; x <<= 1){ rep(bit, 1 << 5){ ll y = x; rep(i, 5){ if (bit & (1 << i)){ y *= table[i]; } } if (3 <= y && y <= a) v.pb(y); } } sort(begin(v), end(v)); v.erase(unique(begin(v), end(v)), end(v)); printf("%d\n", v.size()); }